Welcome to WebmasterWorld Guest from 54.145.144.101

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

[R=301,L] not working

   
1:54 am on Jun 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there any way to make this code work? I think special characters are keeping it from redirecting.

Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^showthread\.php\?t\=10285\&page\=([^.]+)$ http ://www.DOMAIN.com/showthread.php?t=14913 [R=301,L]
RewriteRule ^showthread\.php\?t\=10285$ http ://www.DOMAIN.com/showthread.php?t=14913 [R=301,L]

3:19 am on Jun 28, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



No, the problem is that RewriteRule can't 'see' query strings.

Use something like


RewriteCond %{QUERY_STRING} ^page=foo&destintation=bar$

to test and manipulate query strings.

Search WebmasterWorld for 'rewriterule rewritecond query_string' for lots more threads on this subject.

Jim

11:01 am on Jun 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RewriteCond %{QUERY_STRING} ^t=10285$
RewriteRule ^([^.]+)$ http ://www.DOMAIN.com/showthread.php?t=14913 [R=301,L]

RewriteCond %{QUERY_STRING} ^t=10285&page=([^.]+)$
RewriteRule ^([^.]+)$ http ://www.DOMAIN.com/showthread.php?t=14913 [R=301,L]

isn't working. The change is just changing 10285 to 14913 and URL's with &page= to go to the 14913 url with out &page=.

showthread.php?t=14913

The script URL is the same at both URLs.

2:31 pm on Jun 28, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



The two rules should be reversed, but you only need one anyway:

RewriteCond %{QUERY_STRING} ^t=10285(&page=[^&]+)?$
RewriteRule ^showthread\.php$ http://www.example.com/showthread.php?t=14913%1 [R=301,L]

Jim
 

Featured Threads

Hot Threads This Week

Hot Threads This Month