Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rewrite https to http

Status
Not open for further replies.

glimbeek

Programmer
Nov 30, 2009
83
NL
I want to rewrite all https:// url's to http://

After searching on Google and this forum I found the following post on:

mikemwe uses the following code:

RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ [R,L]

To rewrite all https:// url's to http://

Is this method full proof? I have no use for making certain folders secure or anything like that. I just don't want any https:// url's.

And how about using R=301 instead of R?
 
Google has already indexed some https links even though I don't use any https links on my site.
 
I found the following:

RewriteEngine On
RewriteCond %{HTTPS} =on [OR]
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ [R=301,L]


Should this work?
 
Off the top of my head, I think it should work. You are catching both an attempt to use HTTPS and the port 443 and providing a redirect link.

I use a similar rewrite rule to your first one, no port catch, to redirect to my secure sites for things like my web mail. It seems to work reliably, but then it wasn't meant to be hacker proof, just to prevent my from accidentally entering my password in clear text.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top