benoit1980 Posted May 21, 2014 Share Posted May 21, 2014 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 Quote Link to comment https://forums.phpfreaks.com/topic/288651-how-to-disable-https-for-a-few-urls/ Share on other sites More sharing options...
jazzman1 Posted May 21, 2014 Share Posted May 21, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/288651-how-to-disable-https-for-a-few-urls/#findComment-1480344 Share on other sites More sharing options...
benoit1980 Posted May 21, 2014 Author Share Posted May 21, 2014 Thanks for your help. Actually the /hotels link is not a folder but the way the framework output the page. I am using the Yii framework. How to do it without folder please? Thank you, Ben Quote Link to comment https://forums.phpfreaks.com/topic/288651-how-to-disable-https-for-a-few-urls/#findComment-1480366 Share on other sites More sharing options...
jazzman1 Posted May 21, 2014 Share Posted May 21, 2014 (edited) 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 May 21, 2014 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/288651-how-to-disable-https-for-a-few-urls/#findComment-1480370 Share on other sites More sharing options...
kicken Posted May 22, 2014 Share Posted May 22, 2014 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? Quote Link to comment https://forums.phpfreaks.com/topic/288651-how-to-disable-https-for-a-few-urls/#findComment-1480384 Share on other sites More sharing options...
trq Posted May 22, 2014 Share Posted May 22, 2014 Out of curiosity, why do you want to disable SSL for these paths? Quote Link to comment https://forums.phpfreaks.com/topic/288651-how-to-disable-https-for-a-few-urls/#findComment-1480397 Share on other sites More sharing options...
benoit1980 Posted May 22, 2014 Author Share Posted May 22, 2014 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 Quote Link to comment https://forums.phpfreaks.com/topic/288651-how-to-disable-https-for-a-few-urls/#findComment-1480405 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.