Forum Moderators: phranque

Message Too Old, No Replies

.htaccess rewrite to https

         

Tommybs

12:18 pm on Nov 29, 2009 (gmt 0)

10+ Year Member



Hi,

Was wondering if someone could help me with some .htaccess rules. I have a site where I redirect all requeset to http://example.com to http://www.example.com

What I want to do now though is redirect any requests to certain pages to a https version

e.g someone goes to http://www.example.com/index.php
redirect to [example.com...]
In terms of the index.php file I'd also need to redirect requests to / to the https version.

http://www.example.com/page2.php shouldn't redirect.

I'm not good with .htaccess so would also appreciate an explanation with any code. So far I have this to faciliate http:// to [www....]


RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

g1smd

1:50 pm on Nov 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There was a very long thread just a few days ago with code for redirecting to and from http/https.

Please give that a thorough read through and see if it answers most of your questions.

jdMorgan

3:23 pm on Nov 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The referenced recent http<->https redirection thread is at: [webmasterworld.com...]

Jim