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
Share on other sites

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.