homepage Welcome to WebmasterWorld Guest from
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

301 redirect problem 3 level "directory structure"

5+ Year Member

Msg#: 4526839 posted 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 ?



WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

Msg#: 4526839 posted 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


or possibly


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 ;)


WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 4526839 posted 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.

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