httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Schoenborn <scho...@cae.com>
Subject RE: [users@httpd] best way to modify a URL
Date Thu, 17 Dec 2009 10:16:15 GMT
>> 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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
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


Mime
View raw message