[users@httpd] re-write rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux