Welcome to WebmasterWorld Guest from 54.226.189.112

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 redirect problem 3 level "directory structure"

     

getoffmyisland

6:37 am on Dec 11, 2012 (gmt 0)

5+ Year Member



Hi,

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:

http://www.example.com/property/randburg/r1-45952

..it redirects to
http://www.example.com/residential/property/randburg/r1-45952

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 ?

lucy24

7:41 am on Dec 11, 2012 (gmt 0)

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



http://www.example.com/property/randburg/r1-45952

..it redirects to
http://www.example.com/residential/property/randburg/r1-45952

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

http://www.example.com/property/
to
http://www.example.com/residential/property/

or possibly

http://www.example.com/property/pottersfalls/
to
http://www.example.com/residential/property/pottersfalls/

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

g1smd

10:18 am on Dec 11, 2012 (gmt 0)

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



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month