httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Foster, Stephen \(ASPIRE\)" <steve.fos...@hmrcaspire.com>
Subject [users@httpd] re-write rules
Date Wed, 18 Oct 2006 13:18:04 GMT
hi there,

i am having a slight issue with re-write rules, i have it setup so that any requests that
are not HTTP get re-sent to HTTPS. However if i connect using https://your.domain.com or https://your.domain.com/
i get a page not found, so i need to be able to catch that its https but that there is no
request and to send it to https://your.domain.com/home.

my current rules are:

# =================================================
# Rewrite to HTTPS Settings
# =================================================
RewriteCond %{REQUEST_URI}  !=/heartbeat/heartbeat.htm
RewriteCond %{REQUEST_URI}  !=/server-status
RewriteCond %{SERVER_PORT}  !=443
RewriteRule ^/$ https://your.domain.com/home [R=301,L]
RewriteCond %{HTTP_HOST}   !^your\.domain\.com [NC]
RewriteCond %{HTTP_HOST}   !=""
RewriteCond %{REQUEST_URI}  !=/heartbeat/heartbeat.htm
RewriteRule ^/(.*)  http://your.domain.com:%{SERVER_PORT}/$1 [R=301,L]

The first rules handles the fact that i have to serve heartbeat.htm and server-status as port
80 requests but anything else thats not HTTPS goes to HTTPS.
The second rule matches the incoming domain request to re-write to the correct domain, but
allows heartbeat.htm to send a 200 status code rather than a 301.

Any thoughts would be greatly appreciated

cheers

Steve

Steve Foster | Capgemini | Telford
Shared Technology Services
T. +44 (0) 1952 296664 | www.capgemini.com
Internal: 46664

Join the Collaborative Business Experience 


===========================================================
Our e-mail domain has now changed from iraspire.com to hmrcaspire.com. Please update your
address books.
===========================================================


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message