tags:

views:

98

answers:

1

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?

A: 

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/

pygorex1
Thanks!Seems to solve the problem, but I couldn't create a self-signed certificate following your link because I'm currently running it on Windows.
Amir E. Habib
Unfortunately I can't set a self SSL certificate.Anyone has a step-by-step guid for Apache 2.2 on Windows?
Amir E. Habib
This looks like a pretty good guide: http://www.neilstuff.com/apache/apache2-ssl-windows.htm
pygorex1
I've Apache 2.2 which already comes with OpenSSL support. Do I need to download Hunter's distribution?
Amir E. Habib