Jump to content

Force SSL but exclude certain files.


norbie

Recommended Posts

Hi all,

 

I've running an online shop and would like the /cart/ folder to use SSL only, and all other areas of the site to be non-SSL. This is currently working using the following code:

 

root .htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} !images
RewriteCond %{REQUEST_URI} !includes
RewriteRule ^(.*)$ http://www.domain.com/$1 [R,L]

 

/cart/.htaccess

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domain.com/cart/$1 [R,L]

 

This all works fine. You can see I have excluded the images and includes folder from this rule - this is because when viewing the cart which includes images, there are SSL errors due to the modrewrite trying to show non-SSL images on an SSL page.

 

The only issue I have currently is I have some files eg. /delivery.php in the root of the site that I have linked to in the cart page using the facebox plugin. The issue is that when I click on these links, they do not load properly (I imagine this is because the facebox plugin is being called from an SSL window).

 

Can anyone see a way around this? Perhaps I need to improve the .htaccess code I've already used?

 

Many thanks.

Link to comment
https://forums.phpfreaks.com/topic/206164-force-ssl-but-exclude-certain-files/
Share on other sites

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.