homepage Welcome to WebmasterWorld Guest from 54.226.213.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirecting url's in Apache
How do I redirect URL in Apache
adrenalinehigh




msg:1515671
 5:08 pm on Apr 2, 2003 (gmt 0)

I cannot seem to find the answer to my question anywhere. What I need to do is simply redirect an incoming url to a different one using apache.

Here is an example of what I need to do... If I'm just an idiot, feel free to let me know :)

incoming url= [dog.domain.com...]
redirect to= [domain.com...]

or

incoming url= [cat.domain.com...]
redirect to= [domain.com...]

or

incoming url= [mouse.domain.com...]
redirect to= [domain.com...]

Am I making sense? It seem from what I have read that Apache rules in redirects, rewrites and such... but being a recent convert from IIS and Domino I just don't have the skills to figure this out it seems.

Thanks to anyone that can help!

 

carfac




msg:1515672
 5:24 pm on Apr 2, 2003 (gmt 0)

Hi adrenalinehigh:

Welcome to Webmasterworld!

There are a couple ways to acomplish this, and both depend on certain moidules being in your Apache build... either mod_rewrite or mod_alias. The first allows more complete rewriting, but for this, either will do...

for mod_alias, just add this to your httpd.conf on the appropriate <Container>

RedirectPermanent /URI/TO/OLD/REQUEST/ [URL...]

Note: URI vs. URL- you use BOTH, but you cannot switch one with the other. Your fisrt rewrite would be written:

RedirectPermanent / [domain.com...]

More info here: [httpd.apache.org...]

For mod_rewrite, you would do this:

ReWriteEngine ON
RewriteRule Expression New Location [CODES]

This is much more complex, but you can do a lot more with it, too. But be very careful, it can be quite powerful, and do things you may not expect.

More info here: [httpd.apache.org...]

Good Luck!

dave

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved