Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with ReWrite directive

Status
Not open for further replies.

hookahmasta

IS-IT--Management
Aug 5, 2005
31
US
I'm having trouble with the ReWriteCond and ReWriteRule directive. My objective is to redirective to
which works fine currently, but some users might forget to put in the s in https. I made sure that the module is included, and now,

Here's what I got.

RewriteEngine on
ReWriteCond %{HTTPS} !=off
RewriteCond %{HTTP_HOST} !^subdomain\.domain\.com [NC]
ReWriteCond %{HTTP_HOST} !=""
ReWriteCond %{SERVER_PORT} !=80
RewriteRule (.*) [L,R]

For some reason, it's not working. Actually, when I put in it directs to one of other virtual hosts that I got! Does anyone have any idea?
 
This should work perfectly for you.
Code:
RewriteEngine On
RewriteLogLevel 0
RewriteCond %{HTTP_HOST} ^subdomain.domain.com
RewriteCond ${SERVER_PROTOCOL} !HTTPS
RewriteRule ^/(.*) [URL unfurl="true"]https://%{SERVER_NAME}/$1[/URL] [R,L]

M. Brooks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top