Hi guys, I’ve done a lot of searching and found some very helpful threads.
I want to redirect a directory on my site, /contact-us and all sub-directories to HTTPS.
Any other pages I want to use HTTP.
I found this thread: http://www.sitepoint.com/forums/showthread.php?t=696547 and use dklynn’s example:
RewriteEngine on
# redirect DIRECTORY requiring a secure server
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^checkout https://www.example.com%{REQUEST_URI} [R=301,L]
# redirect pages not requiring a secure server
RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$
RewriteRule !^checkout http://www.example.com%{REQUEST_URI} [R=301,L]
but this doesn’t seem to work for me. If I remove the HTTPS to HTTP part it works fine, but with both blocks in my .htaccess file, any attempt to access a file in /contact-us redirects to the homepage.
I’m not too familiar with this sort of tinkering and I don’t know if this is affected by the Wordpress .htaccess rules below:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Please help!