How to Redirect all Web Traffic on Server to Port 443
Novell Cool Solutions: Tip
By Cade Carvell
|
Digg This -
Slashdot This
Posted: 31 Aug 2005 |
PROBLEM:
Need to redirect all web traffic on a specific server to 443 - for security purposes.
SOLUTION:
|
|||
EXAMPLE:
#This module simply tells apache2 that all connections to
#port 80 need to go to port 443 - SSL - No exceptions
<IfModule !mod_rewrite.c>
LoadModule rewrite_module modules/mod_rewrite.so
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
# The line below sets the rewrite condition. That is,
if the server port does not equal 443, then this condition is true
ReWriteCond %{SERVER_PORT} !^443$
# The line below is the rule, it states that if above
condition is true, and the request can be any url, then redirect
to https:// plus the original url that was requested.
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</IfModule>
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

