Having issue with redirecting whole site to https

Hi Everyone,

Can any one suggest me with the below issue,

we have activated ssl to one of our website below is the redirecting code we are using in .htaccess
RewriteEngine On
RewriteCond %{ENV:HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

redirection works fine with home page, but internal pages do not redirect they are accessible in both version with https and with http

Can anyone suggest me the changes to the code

praneeth,

Have a look at the examples at http://dk.co.nz/seo where I have (with slight modification for your application):

RewriteEngine on RewriteCond %{HTTPS} !on RewriteRule .? https://www.example.com/%{REQUEST_URI} [R=301,L]

Because %{HTTPS} is either null or on, I prefer:

RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule .? https://www.example.com/%{REQUEST_URI} [R=301,L]

Regards,

DK

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.