.htaccess - Redirect select pages to https -


i have simple question reason cannot figure out, , hours of searching has not helped either. using .htaccess file, how can redirect /login.php , /index.php https, , redirect other page http? use code redirect https, redirects every page:

rewritecond %{server_port} !443 rewriterule ^(.*) https://www.ruxim.com/$1 [r]   

thank much.

the %{server_port} variable depends on usecanonicalphysicalport in config. if it's not setup, may not able match against variable, easier use %{https} instead.

rewritecond %{https} off rewriterule ^/?(login|index)\.php https://www.ruxim.com%{request_uri} [l,r]  rewritecond %{https} on rewriterule !^/?(login|index)\.php http://www.ruxim.com%{request_uri} [l,r] 

if don't need redirect non-https, don't need second rule.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -