You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Brian Candler <B....@pobox.com> on 2005/08/21 21:00:39 UTC
[users@httpd] Re: pretty simple mod-rewrite question
On Fri, Aug 19, 2005 at 06:24:02PM -0400, Hank wrote:
> I have a rewrite working well so for one virtual domain:
>
> Convert: http://www.AAsite.com/pf_dir/index.html
> To: http://www.AAsite.info/AAforums/pf_dir/index.html
>
> RewriteEngine on
> RewriteRule ^/pf(.*)$ http://www.AAsite.info/AAforums/pf$1 [L]
>
> What I'd like to do is enhance it so it does the following:
>
> Convert: http://www.AAsite.com/pf_dir/index.html
> To: http://www.AAsite.info/AAforums/pf_dir/index.html
> ..AND:
> Convert: http://www.BBsite.com/pf_dir/index.html
> To: http://www.AAsite.info/BBforums/pf_dir/index.html
>
> Both incoming URL sites are aliases in the same virtual server, but
> the target URL domain name stays the same (AAsite), only the top level
> directory changes "/AA" or "/BB".
>
> Thanks in advance.
Perhaps something along the lines of:
RewriteMap tolower int:tolower
RewriteCond ${lowercase:%{HTTP_HOST}} =www.aasite.com
RewriteRule /(pf.*)$ http://www.AAsite.info/AAforums/$1 [L,R]
RewriteCond ${lowercase:%{HTTP_HOST}} =www.bbsite.com
RewriteRule /(pf.*)$ http://www.AAsite.info/BBforums/$1 [L,R]
Note that if you miss off the http://... prefix, but include [R], then you
will keep the hostname the same in the redirected URL, if that's more useful
for you.
---------------------------------------------------------------------
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