Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Below is some code I added to my .htaccess code how can I add certain pages to be re-directed to https? (such as login.php & login.html)

Also, if the user types in www. they get a "untrusted connection" as the SSL is only valid without the www. How could I fix this?

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /login.html
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
share|improve this question
    
You might want to split those into separate questions. –  womble Nov 17 '09 at 21:03

1 Answer 1

1) You can always explicitly force redirects using the apache RedirectMatch statements:

RedirectMatch ^/login.html$ https://myhostname/login.html
RedirectMatch ^/logout.html$ https://myhostname/logout.html

2) The SSL problem goes away if you explicitly direct traffic to the proper version of the hostname (i.e. get them in the habit of using one format for the url). Another option is to use an SSL wildcard certificate if you want to service multiple hostnames with a single SSL instance.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.