Jump to content

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.

According the directory structure of this framework, try to create the .htaccess file in to the views folder. Everything you need to do is to rewrite the request coming from the controlers to views. 

Edited by jazzman1

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.