views:

14

answers:

1

Hi, I want to redirect http://myip/admin to https://myip/admin. I am trying to use .htaccess to do this (want this only for the admin folder).

Contents of .htaccess placed in the relevant folder:


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

(apache mod_rewrite is enabled). Both http://myip/admin and https://myip/admin are visible (but the redirection does not work). Server is Ubuntu.

I have tried few variations of the above rules from the internet but no luck :(

Any inputs would be appreciated.

regards, JP

A: 

Solved it and learnt something new. The AllowOverride option in apache's main config file was not set correctly.

Also, if someone faces such issues 2 points: 1) apache reload may sometime not work as expected. Try restart 2) Clear browser cache and / or refresh page.

JP19