Jump to content

How to disable https for a few urls?


benoit1980

Recommended Posts

Hi Everyone,

 

I am really struggling with this.....Cannot find a solution anywhere.

 

I have a website with SSL installed.

I would like to force SSL on the whole website but not on 2 urls.

 

If my whole site is https://mysite.com

 

and the 2 urls to disable from the SSL are:

http://mysite.com/hotels

http://mysite.com/weather

 

How can I do it via htaccess please?

 

Thank you so much,

 

Ben

Link to comment
https://forums.phpfreaks.com/topic/288651-how-to-disable-https-for-a-few-urls/
Share on other sites

Hm.....not sure if it works, however try the following example (to the first domain address)

# Redirect the request from https://mysite.com/hotels
# to http://mysite.com/hotels and force using HTTP 
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTPS_HOST} ^www.mysite.com/hotels/?$ [OR]
RewriteCond %{HTTPS_HOST} ^mysite.com/hotels/?$
# force HTTP
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://mysite.com/hotels [R=301,L]

Create the .htaccess file inside /hotels directory an give me a feedback what happens on that.

Probably something like this in your main .htaccess (or virtualhost block) would work (untested):

RewriteCond %{HTTPS} =on
RewriteRule ^/hotels(.*)$ http://yoursite.com/hotels$1 [R=permanent,QSA,L]
You'll need to make sure whatever you use to force SSL to be on for the rest of the site will ignore these paths, otherwise you'll just end up creating a loop.

 

Out of curiosity, why do you want to disable SSL for these paths?

Thank you ,

 

I will check this later on.

The reason I must disable https for this particular page is because I am using an affiliate that shows hotels people can book.

For the affiliate to work I had to point the CNAME of a subdomain they asked me to create as:

hotels.mysite.com to --> Affiliate.hotels.com

 

Now imagine that this sub points to the subdomain and the user cannot see anything else in the browser rather than hotels.mysite.com.

 

The next problem was to incorporate this hotel searchin the framework to fit with the rest of the rest, I was force to use an iframe but as you know,

the iframe will be outputting an http url inside a site that is fully https.

Due to this problem, the iframe shows a blankpage.......

 

 

I hope you understand.

 

Regards,

 

Ben

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.