Jump to content

Need encryption for some bits and not others


kevintynfron

Recommended Posts

Hi all,

 

We have a website where we want users to browse unencrypted for most of it, but move to encrypted when they move to other areas. We also want to make sure all URI start www.

 

at the moment, .htaccess in the httpdocs root has the following

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www.example.co.uk$
RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R=301]

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} operator [OR]
RewriteCond %{REQUEST_URI} your_account [OR]
RewriteCond %{REQUEST_URI} buy_tickets/checkout [OR]
RewriteCond %{REQUEST_URI} sell_tickets
RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R,L]

 

I'm guessing that it's the first rewrite rule that's doing it with the "https". Does it then carry on after the re-write onto the second?

 

On another note, would I be better off putting this in httpd.conf somewhere?

 

I have been trying to test this, but am having real problems getting mod_ssl going on my test platform (but that's another story....) so thanks for any help.

 

Cheers,

Kevin

 

Link to comment
Share on other sites

Thanks corbin.

 

if(the host is exactly equal to "www.example.co.uk") {

 

Isn't that "if (the host is not exactly equal to "www.example.co.uk") {" ? I thought the '!' was a NOT operator

 

In which case presumably changing the https to http would work.

This seems like a bit of a quick'n'dirty way to do it, not that I know of any other way. Is there another way that anyone knows of?

 

Cheers,

Kevin

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.