.htaccess - How to redirect specific folder from HTTP to HTTPS -


i struggling redirect e-shop located in folder called shop. have 2 htaccess files, 1 on domain root (the 1 dedicated corporate website) , other 1 placed in shop folder. i've tried many variations of rewrite rule, can't make work...

if put shop's htaccess file redirect loop error:

rewriteengine on rewritecond %{https} off rewriterule (.*) https://%{http_host}%{request_uri} 

this doesn't in both htaccess files:

rewriteengine on rewritecondition %{server_port} !^443$ rewriterule ^(.*)$ https://www.maindomain.com/order/$1 [r=301,l] 

neither when put htaccess file located on document root:

rewriteengine on rewritecond %{https} !=on rewriterule ^(subdirectory/.*)$ https://www.mydomain.com/$1 [r=301,l] 

note: if makes difference, have redirect rule well. located in htaccess on document root:

rewritebase / rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /index.php?/$1 [l] rewritecond %{http_host} !^rumako.cz$ [nc] rewriterule ^(.*)$ http://rumako.cz/$1 [l,r=301] rewritecond %{request_uri} ^application.* rewriterule ^(.*)$ /index.php?/$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /index.php?/$1 [l] 

and 1 in shop's htaccess:

    rewriteengine on     rewritebase /shop     rewriterule ^sitemap.xml$ index.php?route=feed/google_sitemap [l]     rewriterule ^googlebase.xml$ index.php?route=feed/google_base [l]     rewritecond %{request_filename} !-f     rewritecond %{request_filename} !-d     rewritecond %{request_uri} !.*\.(ico|gif|jpg|jpeg|png|js|css)     rewriterule ^([^?]*) index.php?_route_=$1 [l,qsa] 

please advise. answers...

your first rule correct, must add r flag

rewriteengine on rewritecond %{https} off rewriterule ^ https://%{http_host}%{request_uri} [r,l] 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -