I'm trying to redirect https://www.example.com/innerdirectory/ to http://www.example.com/innerdirectory/ . I tried the following code in the .htaccess file. But its still loading with https.
I have the .htaccess file in http://www.example.com/innerdirectory/ and its home page.
RewriteCond %{HTTPS} on
RewriteRule ^/?$ http://%{SERVER_NAME}/ [R=301]
RewriteRule ^innerdirectory/?$ http://%{SERVER_NAME}/innerdirectory/ [R=301,L]
Any suggestions?
Your second rewrite rule is unconditionally redirecting http://example.com/innerdirectory back to http://example.com/innerdirectory causing a Redirect loop error. You need set a condition to the rule so that it redircts https to http only. try :
RewriteEngine on
#if https==on
RewriteCond %{HTTPS} on
#Redirect "http://example/innerdir" to "https://example/innerdir"
RewriteRule ^innerdirectory/?$ http://%{HTTP_HOST}%{REQUEST_URI} [NC,L,R]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.