You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Foster, Stephen (ASPIRE)" <st...@hmrcaspire.com> on 2006/10/18 15:18:04 UTC
[users@httpd] re-write rules
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