Prabhakar Kasi's Raptor.in

Interesting News Naturally Interests Everyone

Apache URL Redirecting

Posted by admin On March - 21 - 2009

apache_logoURL Redirect

URL Redirection is used primarily for redirecting from old URL to new URL.

My OLD URL was

http://entertainment.raptor.in/mirchi%20suchi/

which i needed to redirect to

http://raptor.in/?s=suchitra

Solution
Redirect 301 “/mirchi suchi/” http://raptor.in/?s=suchitra

Challenge
The challenge here was that my old url contained a white space which took me a lot of time to fix. Then I found a solution after googleing. To understand the solution I found was even more challenging. Since entertainment.raptor.in was a sub-domain I tried to put this redirect rule in .htaccess in the entertainment folder.

For those who don’t know how sub-domains work.
http://entertainmet.raptor.in is same as http://raptor.in/entertainment

I tried to put the solution in the .htaccess under entertainment directory and the rule didn’t seem  to work.
Redirect 301 “/mirchi suchi/” http://raptor.in/?s=suchitra

Then I came to understand that rewriteBase base was creating the problem. When .htaccess file is within a  directory(in my case entertainment directory) you can only redirect to the same directory(only to entertainment directory) and not the preceeding directory(my root directory).

This would have worked for me in the .htacess file under entertainment directory.

Redirect 301 “/mirchi suchi/” http://raptor.in/entertainment?s=suchitra
Redirect 301 “/mirchi suchi/” http://entertainment.raptor.in/?s=suchitra

Other Samples
Redirect 301 “/mirchi suchi/” http://raptor.in/?s=suchitra
Redirect 301 “/Sivaji – The Boss 2007/august news.htm” http://raptor.in/category/entertainment/
Redirect permanent /vista/default.htm http://raptor.in/category/computer/windows-vista

pixelstats trackingpixel

Popularity: 6% [?]

Leave a Reply