Search code examples
apachehttps

Disable https on localhost


I need to automatically redirect any https:// to http:// on my localhost environment. I tried to use a .htaccess file which I placed on my htdocs/ with the following code:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

For some reason this is not working. Any advice?


Solution

  • The problem with the rewrite rule is that it will never be reached if apache is not configured properly for SSL. The browser is trying to connect to http://localhost:443 and unless apache or some other service is configured on that port you'll get a timeout.

    The best solution would be to create a self-signed certificate for apache running on localhost and create a rule in your web browser to trust the certificate:

    Create a self-signed certificate for apache:

    http://www.perturb.org/display/entry/754/