Redirect www.example.com/apple to food.example.com/fruits/apple

Posted by Senthil on Stack Overflow See other posts from Stack Overflow or by Senthil
Published on 2011-01-17T07:45:19Z Indexed on 2011/01/17 7:53 UTC
Read the original article Hit count: 306

I want to redirect users from

www.example.com/apple

to

http://food.example.com/fruits/apple

Note:

  1. This is a hardcoded redirection. Even a mapping if you will. "apple" will not be substituted with anything else. Nothing in the two URLs will change except for the domain of course. So there is no need for a regular expression to match the "apple" or anything else.
  2. There is already dozens of RewriteCond and RewriteRule things in the .htaccess file. I do not want them to be affected. This redirection is independent of those.

I have access to the .htaccess file at the root of www.example.com and the httpd.conf

What code should I put in .htaccess in order to achieve this? Or should I change the httpd.conf?

© Stack Overflow or respective owner

Related posts about apache

Related posts about .htaccess