Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

redirects going to wrong page entirely



10:54 pm on Jan 11, 2012 (gmt 0)

10+ Year Member


I have a weird one here.

My redirects seem ok, but in some cases, the page being redirected to is not correct.

They all seem to be cases like the following

RewriteCond %{REQUEST_URI} ^/forum/discussion/71/*
RewriteRule ^(.*)$ /newpath/topic/growing-tomatoes/ [R=permanent,L]

RewriteCond %{REQUEST_URI} ^/forum/discussion/711/*
RewriteRule ^(.*)$ /newpath/topic/cutting-grass/ [R=permanent,L]

...where the bottom one is also ending up athe the top one;s destination. in other words discussion 711 is going to the growing tomatoes page.

Why is this?

Thanks for your help.


11:34 pm on Jan 11, 2012 (gmt 0)

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

71/* means 0 more slashes so matches both 71<anything> (and thereby 711) and 71///////<anything>

The rule for redirects is that the most specific redirects go first, i.e. reverse the order of the two rules.

Additionally, you might (or might not) want to change the * to a + too.

The rule target should also include both protocol and hostname.

Finally, there is no need for the RewriteCond here. The URL test should be directly in the RewriteRule RegEx pattern (and without leading slash).


11:47 pm on Jan 11, 2012 (gmt 0)

10+ Year Member

great, fixed! Thank you so much.

Featured Threads

Hot Threads This Week

Hot Threads This Month