To redirect from HTTPS to HTTP on the home page only using the following rule.
RewriteCond %{HTTPS} on
RewriteRule ^/?$ http://%{SERVER_NAME}/ [R=301,L]
The variable %{HTTPS} will be either "on" or "off" and will be enabled even if SSL is not installed on your site. The rule above sees that HTTPS is on and redirects the home page to the HTTP version. You can even chain lots of rules together like this.
RewriteCond %{HTTPS} on
RewriteRule ^/?$ http://%{SERVER_NAME}/ [R=301]
RewriteRule ^inner/directory/?$ http://%{SERVER_NAME}/inner/directory/ [R=301,L]
Note that you should end your last rule with L so that no other rules on the page are run. Also, you need to make absolutely sure that you are not redirecting any pages that are integral to the security of your shopping cart as this will turn off HTTPS for those pages.
You can also do the same thing using the ${SERVER_PORT} variable.
RewriteCond %{SERVER_PORT} 443
RewriteRule ^/?$ http://%{SERVER_NAME}/ [R=301,L]
The port for HTTPS is 443 so if the port being communicated through is 443 we need to redirect.
Comments
hi there,
I am trying to redirect https to http for the website coupon aid
I changed htaccess but it doesn't seem to work. Could you take a look and see what the problem is?
it's not redirecting :(
If it isn't redirecting then there are a couple of things you can try. The rules above require mod_rewrite being available on your Apache server, if it isn't on then the rules throw and error. There may be an issue with the expression you are using to redirect if you are trying to do it with an inner directory. Either way, any errors should be logged by your Apache server in the error.log so if nothing works that should point you in the right direction.
Hello,
RewriteCond %{HTTPS} on
RewriteRule ^/?$ http://%{SERVER_NAME}/ [R=301]
RewriteRule ^inner/directory/?$ http://%{SERVER_NAME}/inner/directory/ [R=301,L]
after using this above code i faced a problem like directory index listing enable and trying to make it disable is not working using htaccess file or other source.
just i need to redirect HTTPS to HTTP . please provide me a solution for this and also let me how to disable the index listing.
i used many possible way to redirect or disable index listing is not working..
I want to say my website ssl remove & http (S) only how to remove any suggest
I hope this will be helpful for someone
RewriteEngine On
RewriteBase /
# Turn SSL on for /user/login
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/(yourfilename\.php)$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
# Turn SSL off everything but /user/login
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/(yourfilename\.php)$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]