Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-24-2006, 09:05 PM   PM User | #1
Fad2
New to the CF scene

 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Fad2 is an unknown quantity at this point
SSL Mod Rewrite

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.
Fad2 is offline   Reply With Quote
Old 04-24-2006, 09:45 PM   PM User | #2
schleppel
Regular Coder

 
Join Date: Oct 2004
Posts: 330
Thanks: 0
Thanked 13 Times in 13 Posts
schleppel is an unknown quantity at this point
This should work, but i don't have SSL to test. Put it in a .htaccess file in your root directory:
Code:
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).
schleppel is offline   Reply With Quote
Old 04-24-2006, 09:53 PM   PM User | #3
Fad2
New to the CF scene

 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Fad2 is an unknown quantity at this point
Your code works like a charm schleppel, really appreciate you taking your time to help me.
Fad2 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:57 AM.


Advertisement
Log in to turn off these ads.