RE: [users@httpd] Help with re-write rules

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

 



Hi robert,

thanks for this, it has been a great help. It now serves the pages as i want
them without any extraneous entries in the log files. Our application
proxies directly to weblogic using the /home context which is why i want all
requests to land at that point except , obviously, for the heartbeat and
server-status pages.

many thanks for your input.

Steve


-----Original Message-----
From: Robert Ionescu [mailto:robsiegen@xxxxxxxxxxxxxx]
Sent: 14 August 2006 20:36
To: users@xxxxxxxxxxxxxxxx
Subject: Re: [users@httpd] Help with re-write rules


Foster, Stephen (ASPIRE) wrote:
> # =================================================
> # Rewrite to HTTPS Settings
> # =================================================
> RewriteCond %{HTTP_HOST}   !^online\.domain\.com [NC]
> RewriteCond %{HTTP_HOST}   !^$

Use lexicographically equal (!="") here instead of a regular expression
> RewriteRule ^/(.*)         http://online.domain.com:%{SERVER_PORT}/$1 [R]
> RewriteCond %{REQUEST_URI}  !^/heartbeat/heartbeat.htm
> RewriteCond %{REQUEST_URI}  !^/server-status
> RewriteCond %{SERVER_PORT}  !^443$
> RewriteRule ^/(.*)$ https://%{SERVER_NAME}/home [R,L]

Why are you using Server_Name, if you force this to be 
online.domain.com or online.domain.com:%{SERVER_PORT}. Should every 
request really go to /home?

I think you're looking for something like

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

-- 
Robert

---------------------------------------------------------------------
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


===========================================================
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