httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Foster, Stephen \(ASPIRE\)" <>
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 or
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

my current rules are:

# =================================================
# Rewrite to HTTPS Settings
# =================================================
RewriteCond %{REQUEST_URI}  !=/heartbeat/heartbeat.htm
RewriteCond %{REQUEST_URI}  !=/server-status
RewriteCond %{SERVER_PORT}  !=443
RewriteRule ^/$ [R=301,L]
RewriteCond %{HTTP_HOST}   !^your\.domain\.com [NC]
RewriteCond %{HTTP_HOST}   !=""
RewriteCond %{REQUEST_URI}  !=/heartbeat/heartbeat.htm
RewriteRule ^/(.*){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



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

Join the Collaborative Business Experience 

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

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message