Robert 12345
Robert 12345

Reputation: 7

Redirect HTTPS to HTTP on localhost

I have an SSL certificate on the production server of my website, but when I run the website site on the local server I see a security message because there is no certificate locally.

What can I add to the htaccess file to prevent HTTPS from being run on the Localhost?

My current htaccess code is below:

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] 
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]

Upvotes: 0

Views: 1700

Answers (1)

rustyx
rustyx

Reputation: 85341

It's unclear what you're asking.

If you're asking how to prevent http://localhost/some_path from being rewritten by Apache mod_rewrite to https://www.localhost/some_path, then try adding this just before RewriteRule:

RewriteCond %{HTTP_HOST} !localhost

Upvotes: 1

Related Questions