apache - Issue with .htaccess sending http to https -
i want send http traffic https. code utilize in .htaccess file :
rewriteengine on rewritecond %{https} !=on rewriterule ^(.*)$ https://%{http_host}/$1 [r,l]
this seems work fine pages except ones in website home directory. eg. when type http://mywebsite.com/index.php goes https://mywebsite.comindex.php forgets slash
here method use...
rewritecond %{https} off rewriterule (.*) https://%{http_host}%{request_uri} [r,l]
it checks if https off. redirect https version. need grab request uri. otherwise redirect homepage of domain.
and little sidenote, may want 301 redirect. alter sec line this:
rewriterule (.*) https://%{http_host}%{request_uri} [r=301,l]
cheers
apache ssl https
No comments:
Post a Comment