RE: best way to modify a URL

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

 



>> RewriteCond   %{HTTP_HOST}                 ^dodo\.foo\.com$
>> RewriteRule   ^/bar/(.*)               /$1    [R,L]
>>
>> RewriteCond   %{HTTP_HOST}                 ^dodo\.foo\.com$
>> RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
>> RewriteRule   ^dodo\.foo\.com/(.*)    http://foo.com/bar/$1   [P]
>>
> Also, in your example above, for me instinctively the last 3 rules look
> like you are doing some extra work that should not be necessary :
> - you test if the host name is "dodo.foo.com"
> - then you modify the URL to add this hostname in front of the URL
> - only to strip it out again and redirect to "foo.com/bar/" with a proxy
> rule

Good point. I'll have to see if I can combine them, I based those two rules on an example, but I may be able to get away with 

RewriteCond   %{HTTP_HOST}                 ^dodo\.foo\.com$
RewriteRule   ^(.*)    http://foo.com/bar/$1   [P]

There are a couple other issues: 
1. minor performance issue: all CSS and javascript etc (which all start with /bar/ in URL) do not need a redirect so I should probably filter those out if possible
2. major issue: form POST problem: form POST should probably not get redirected either, but so far I can't find what condition to test for

> Considering your latest answer, I am also now inclined to think that
> using <VirtualHost> sections would be much cleaner.

More efficient, more maintainable, or less code to write to obtain same effect?


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