Forum Moderators: phranque

Message Too Old, No Replies

F1 on Rewrite

Rewrite the request based on the request uri.

         

avinashbandgi

12:02 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



I have read through the messages here, and while I can't find a solution my problem. Iam new to the Apache webserver world. I am sure some can help me.

For eg:
I have domain called www.mydomain.com. I want to do 2 things.
* If the request URI is business (http://www.mydomain.com/business/*) i want to rewrite the request as [anotherhost:81...] (uri remain same but the host changes)

* if i get a request as [business.mydomain.com...] I want to rewrite the request as [anotherhost:81...] (uri remains same).

Any possible solution.
Thanks in advance.

Regards,
Avinash.

jdMorgan

3:36 pm on Jul 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Avinash,

Welcome to WebmasterWorld [webmasterworld.com]!

In accordance with our charter [webmasterworld.com], we'll be happy to help you learn how to do this, or to help you get your own code working, but we can't write it for you. We would simply get too many requests, and this would leave you dependendent on WebmasterWorld for "support."

Here are some links to help get you started:

Apache mod_rewrite documentation [httpd.apache.org]
Apache URL Rewriting Guide [httpd.apache.org]
Regular Expressions Tutorial [etext.lib.virginia.edu]

You will need to use a RewriteCond to check the %{REQUEST_URI} for "/business" and a RewriteRule with a page-name back-reference to do the rewrite.

Jim