You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Charles Payne (Travel Channel)" <ch...@travelchannel.com> on 2008/11/06 20:47:48 UTC

[users@httpd] Question on mod_rewrite

Guys, 

I have an issue that I can seems to find online. I have a mod_rewrite rule
that looks like this

RewriteRule ^/test      http://myother.webserver.com [R]

But what I want to do is anything that is a part of the directory /test I
want it to go to the other server.

Can I do something like thing

RewriteRule ^/test* http://tdocs.travelchannel.com/teams/Login.do

Sorry this might be an easy question but I can seem to find a straight
answer on google.

Thanks


======================
Charles "Chuck" Payne
System Administrator
Travel Channel
3700 Mansell Rd, Suite 500
Alpharetta, GA 30022
www.travelchannel.com
-----------------------
Email:  Chuck.Payne@TravelChannel.com
Desk Phone:  404-269-5533 (x65533)
Fax Number: 404-269-5461
Blackberry Number:  770-940-7765
Personal Cell: 404-451-3579
aim: terrorp
gtalk: terrorpup@gmail.com
-----------------------





Re: [users@httpd] Question on mod_rewrite

Posted by Justin Pasher <ju...@newmediagateway.com>.
Charles Payne (Travel Channel) wrote:
> Guys,
>
> I have an issue that I can seems to find online. I have a mod_rewrite 
> rule that looks like this
>
> RewriteRule ^/test      http://myother.webserver.com [R]
>
> But what I want to do is anything that is a part of the directory 
> /test I want it to go to the other server.
>
> Can I do something like thing
>
> RewriteRule ^/test* http://tdocs.travelchannel.com/teams/Login.do
>
> Sorry this might be an easy question but I can seem to find a straight 
> answer on google.
>
> Thanks

The first component of a RewriteRule is a regex, so something like this 
should get you there (you were close).


RewriteRule ^/test.* http://tdocs.travelchannel.com/teams/Login.do

Now, this will redirect anything that starts with /test, so if you want 
to make sure the request is a directory, you can make it stricter as 
follows:

RewriteRule ^/test/.* http://tdocs.travelchannel.com/teams/Login.do


Justin Pasher

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


Re: [users@httpd] Question on mod_rewrite

Posted by Krist van Besien <kr...@gmail.com>.
On Thu, Nov 6, 2008 at 8:47 PM, Charles Payne (Travel Channel)
<ch...@travelchannel.com> wrote:

> Can I do something like thing
>
> RewriteRule ^/test* http://tdocs.travelchannel.com/teams/Login.do
>
> Sorry this might be an easy question but I can seem to find a straight
> answer on google.

You will find a straight answer in the apache documentation:

http://httpd.apache.org/docs/2.2/rewrite/

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

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