Page 1 of 1

rewrite in .htaccess has no effect

Posted: Fri Dec 18, 2015 11:09 am
by jimmyeao
I have this in a .htaccess file

Code: Select all

RewriteCond %{ENV:HTTPS} !1
RewriteRule ^(.*)$ https://%{HTTP_HOST}/%1 
So that visitors trying to access that site using https are redirected to http.
However, it seems to be ignored OR Vesta (using nginx as a proxy with Apache) is intercepting the https and redirecting it elsewhere.
Any https request for a non https site ends up on my first https domain :/
for example, lets say I have 2 domains, nonsecure.net and secure.net
nonsecure.net has no https. secure.net has https.
If i try https://nonseure.net the webpage returned is actually the site under https://secure.net...

Re: rewrite in .htaccess has no effect

Posted: Sat Dec 19, 2015 10:45 am
by Elizine
Ensure you have this line in your httpd.conf:

Code: Select all

AllowOverride All
AllowOverride controls what directives may be placed in .htaccess files.

In order to test whether .htaccess is enabled or not, insert some junk text in it and see if it generated a 500 internal error or not.