apache - htacces if statement https redirect for one page -
i've made big mistake of client's secure pages , relative navigation , google has started indexing site showing https in results , not http version "breaks" site.
i want 301 redirect pages except one, non https version in htaccess.
i'm trying redirect every page except /(language variable)/form.html http:// version i'm running apache 2.2.26. saw similar want below i'm not running apache 2.4 500 error.
rewriteengine on <if "%{http_host} == 'www.canpujolet.com/^([a-z]{2})/form.html$'"> rewritecond %{https} off rewriterule ^([a-z]{2})/form.html$ https://www.canpujolet.com/$1/form.html [r=301,l,qsa] </if> <else "%{http_host} !== 'www.canpujolet.com/^([a-z]{2})/form.html$'"> rewritecond %{https} on rewriterule (.*) http://%{http_host}%{request_uri} [r=301,l,qsa] </else>
any , advice appreciated.
you can use:
rewriteengine on rewritecond %{https} off rewritecond %{the_request} \s/[a-z]{2}/form\.html rewriterule ^[a-z]{2}/form\.html$ https://%{http_host}%{request_uri} [r=301,l,nc] rewritecond %{https} on rewriterule !^[a-z]{2}/form\.html$ http://%{http_host}%{request_uri} [r=301,l,nc]
Comments
Post a Comment