Automatic redirect to https

It’d be nice if interworx supported a way to set a domain to redirect any http connections to https.

The recommended way seems to be via a separate vhost:

You can also do this through mod rewrite, but I’ve hit a few problems with doing it that way – mostly around subdomains. Seems like something interworx is doing to support subdomains via mod rewrite causes redirects to not work very well (various things like redirecting to the www instead of subdomain, adding on the subdomain to the path, etc, seemed to happen no matter how I tweaked my rewrite rule).

Hi eviljim

I had to do this for a client and it’s just a little line in vhost file

Works lovely and redirects to URL inputed by user ie or

I think I used the following in the https logic

RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]

I could be wrong with my 1 line as I’d need to check tommorow when I can access the vhost file

Many thanks


Yeah, I’ve done something similar, though in htaccess:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]

And this actually works fine for www and the naked domain. But with subdomains weird stuff happens, eg, “” would redirect to “” and similar weird stuff.

I didn’t try putting it in the vhost – it might work better if it is there and comes before the other rewrite rules. Probably worth a shot.

Try this:
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Hi eviljim and dss

Please do not forget subdomains have their own area and the htaccess for would not work for the

I believe you would have to set a htaccess file for subdomain and it should work.

I could be wrong though sorry

Many thanks