Friday, April 16, 2004

How to redirect URL in Apache.

Two methods using apache configuration.
1. Mod_alias module
The Redirect directive maps an old URL into a new one. The new URL is returned to the client which attempts to fetch it again with the new address
Redirect /service http://foo2.bar.com/service

2. Mod_rewrite module
The Apache server’s mod_rewrite module gives you the ability to transparently redirect one URL to another, without the user’s knowledge
RewriteEngine on
RewriteRule ^old\.html$ new.html

No comments:

Post a Comment