Reputation: 23
My programmer wrote me this (see below) for my htaccess file to redirect all requests for https to http. I have a SSL but I am not using it on any files at the moment so I just need to simply redirect all https's to the http version. It is now working but only for my homepage.
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Is this correct ? Or do I need to add something?
Upvotes: 1
Views: 81
Reputation: 42875
The code you were given is correct, but you have to enable the rewriting engine before usage. Also the usage of .htaccess
style files has to be activated inside the main server configuration. Please see the excellent apache documentation about that topic.
RewriteEngine on
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Apart from this a general hint: if you have access to the main server configuration (to enable such use), then it makes sense to place such rules right inside the host configuration instead of using .htaccess
style files. Such files are notoriously error prone, make things complex, are hard to debug and really slow the server down.
Upvotes: 1