...

SSL Mod Rewrite

Fad2
04-24-2006, 09:05 PM
Hey,

I would like to have selected pages show under SSL. So if a user was viewing:

http://MYDOMAIN.com/signup.php

I want it to automatically redirect to

https://MYDOMAIN.com/signup.php

Can someone tell me how to do this with .htaccess?

Thanks in advance.

schleppel
04-24-2006, 09:45 PM
This should work, but i don't have SSL to test. Put it in a .htaccess file in your root directory:
RewriteEngine On

RewriteCond %{SERVER_PORT} !^443$
# the pages are inside the "()" seperated by "|"s
# if it's in a subdirectory, put the whole path (no starting "/")
RewriteRule ^(signup\.php|otherpage\.php|dir/some/thirdpage\.php)$ https://%{HTTP_HOST}%{REQUEST_URI} [QSA,R=301,L]

I'm assuming your SSL runs on the default port (443).

Fad2
04-24-2006, 09:53 PM
Your code works like a charm schleppel, really appreciate you taking your time to help me.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum