| redirects going to wrong page entirely
|
starchild

msg:4406039 | 10:54 pm on Jan 11, 2012 (gmt 0) | Hi, 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.
|
g1smd

msg:4406045 | 11:34 pm on Jan 11, 2012 (gmt 0) | 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).
|
starchild

msg:4406051 | 11:47 pm on Jan 11, 2012 (gmt 0) | great, fixed! Thank you so much.
|
|
|