htaccess Elite

Hire htaccesselite professional

.htaccess tutorial


All times are UTC - 5 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Redirecting All or Part of a Server to SSL
PostPosted: Oct 24th, '06, 17:34 
User avatar

Joined: Sep 24th, '06, 22:48
Posts: 240
Redirect non-https requests to https server fixing double-login problem and ensuring that htpasswd authorization can only be entered using HTTPS:
Code:
SSLOptions +StrictRequire
SSLRequireSSL
SSLRequire %{HTTP_HOST} eq "google.com"
ErrorDocument 403 https://google.com


NOTE: This code fixes the issue of having to type in the username and password twice. (more info about this)

This will check to make sure that the connection IS using SSL, or it will fail.
It will also check to make sure that the HOST is tirmassagestone.com or it will fail
If it fails, it will issue a 403 "Forbidden" which will redirect to https://google.com


NOTE:There is a more thorough article at [url=http://www.askapache.com/htaccess/apache-ssl-in-htaccess-examples.html]AskApache.com
[/url]

Redirect everything attached to port 80:
Code:
RewriteCond "%{SERVER_PORT}"       "^80$"
RewriteRule "^(.*)$"               "https://%{SERVER_NAME}$1" [R=301,L]






Redirect particular URLs to a secure version:
Code:
RewriteRule "^/normal/secure(/.*)" "https://%{HTTP_HOST}$1" [R=301,L]






Check to see whether the HTTPS environment variable is set:
Code:
RewriteCond %{HTTPS} !=on
RewriteRule "^(/secure/.*)" "https://%{HTTP_HOST}$1" [R=301,L]






Use the Redirect directive to cause a URL to be served as HTTPS:
Code:
Redirect / https://google.com/






Changing the scheme (SSL/noSSL) using relative URLs:
Code:
RewriteEngine on
RewriteRule   ^/(.*):SSL$   https://%{SERVER_NAME}/$1 [R,L]
RewriteRule   ^/(.*):NOSSL$ http://%{SERVER_NAME}/$1  [R,L]


This lets you use hyperlinks of the form document.html:SSL


Last edited by produke on Nov 21st, '06, 05:04, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Oct 30th, '06, 18:26 
User avatar

Joined: Sep 24th, '06, 22:48
Posts: 240
http://forum.powweb.com/showthread.php?t=70609
http://forum.powweb.com/showthread.php?t=70608


Top
 Profile  
 
 Post subject:
PostPosted: Feb 26th, '07, 08:55 

Joined: Oct 31st, '06, 23:19
Posts: 25
Apache SSL in .htaccess


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB