| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|301 redirect problem 3 level "directory structure"|
| 6:37 am on Dec 11, 2012 (gmt 0)|
I had to redirect about 60 pages like below:
Redirect 301 /property/randburg/r1-45952 http://www.example.com/residential/property/randburg
Redirect 301 /property/bryanston/b1-67706 http://www.example.com/residential/property/bryanston
Redirect 301 /property/illovo http://www.example.com/residential/property/illovo
Redirect 301 /property/broadacres-ah http://www.example.com/residential/property/broadacres
But when i visit this link on the old domain:
..it redirects to
It adds this at the end: /r1-45952
It only happens with url with characters similar to /r1-45952 at the end, all other redirects work fine.
I've tried organizing the 301 redirects to most specific first, most general last
But I'm still experiencing the problem.
Any fix for this ?
| 7:41 am on Dec 11, 2012 (gmt 0)|
..it redirects to
Key difference between mod_rewrite (RewriteRule, which can make a redirect) and mod_alias (Redirect by that name): mod_alias reappends the rest of the path.
Somewhere you've got a rule that redirects
Anything that originally came after /property/ will be reattached after /property/ in the redirect.
Solution is to change everything from mod_alias to mod_rewrite. If you've got a text editor that does Regular Expressions, you can do it all in a couple of global search-and-replace operations.
You'll never look back ;)
| 10:18 am on Dec 11, 2012 (gmt 0)|
Use RewriteRule configured as a 301 redirect for all of your rules. Make sure the rule target includes both protocol and hostname.
Make sure your non-www/www canonicalisation redirect is last in the list.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved