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

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

 



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



[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