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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to redirect 443 request to 80

Status
Not open for further replies.

csgonan

MIS
May 2, 2007
118
US
On my solaris apache server I have 1 ssl vhost for a customer and only one IP. My 80 web sites that enter by mistake are going to the SSL.

I cannot get another IP or port so is there a way to check the requesting URL in an htaccess file or something and redirect them to either their port 80 site. It is on the same server and such.

If there are any other suggestions I am open to them too.

Thanks
 
I had seen that site, Thank you.

I have not done rewrites in the past so I don't know how to code them but what those examples look like it is taking any https request and sending it to one specific http site or all https to http. I have one https site and if any other request is made for https (besides that), it should go to the requested site on port 80.

How do I check if the request is the one proper https site and any other are sent to their own site but just port 80.

thanks so much in advance.
 
.htaccess only affects the one site that it is in the root of, that code goes into the .htaccess that is placed in the https root,
and any requests for will be redirected to
Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Hi,

Thank you but I'm having a hard time finding out how to code it to check for the one url that is supposed to be https, and redirect all others to their appropriate http sites.

I thought checking REQUEST_URI would do it but apparently that checks everything after the site name.

How can I capture the site and check if it is sslsite.company.com, and if it is not, send it to the same site as requested but port 80.

Thanks
 
Hi,

I have been doing some research and wonder if this will work. What I want is if the user does not enter then then are sent to the site they requested not on 80. Will %1 be the requested URL (ie) other.site.com?

RewriteEngine On
RewriteCond %{HTTP_HOST} !^ssl\.site\.com$ [NC]
RewriteCond %{HTTP_HOST} !^$ [NC]
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^(.*)$ " [L,R]

Also, there may not be anything after the url even though I put $1? Will that carry over any trailing directories if they are there? If there are not trailing directories, will it cause a problem if it is included in the Rule?

thanks
 
Ok, so I've re-read the post several times and think I understand correctly.

It's not a simple matter of a redirect from HTTPS: to HTTP: and to be honest the only realistic way is to get another IP for the SSL.


HTTPS does not use Virtual Hosts to resolve the server, it uses the IP which is why each SSL certificate requires a seperate IP on the server.

I can't think of a way to use htaccess to handles even scripting a solution would be fairly complicated.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Thank you.

I appreciate your help but I must be explaining myself wrong.

What is happening is I have 1 ssl virtual host on the server.

<VirtualHost 111.222.333.444:443>

It has a separate virtual host container as all ssl apache configurations do. So any of my sites that are using https by mistake to access their site are being sent to the one ssl virtual host. So I want to put an htaccess in that DocumentRoot and send the requests to their requesting site but on port 80 that do not match the condition.

I see examples of people doing it from 80 -> 443 but they are just doing it without checking the URL being requested.

Thanks
 
Yep I understood after reading it again (properly) :D .


The problem is, as you are finding out, is that the VirtualHost name does not exist is the encrypted HTTPS Headers. So there is no way of finding out what hostname was requested once the secure site has responded.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top