Forum Moderators: phranque
.htaccess file
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} TOPIC_ID=([0-9]+)
RewriteRule ^topic.asp$ /forum/index.php?showtopic=%1 [R=301,L,QSA]
RewriteCond %{QUERY_STRING} FORUM_ID=([0-9]+)
RewriteRule ^forum.asp$ /forum/index.php [R=301,L,QSA]
RewriteCond %{QUERY_STRING} ^TOPIC_ID=([0-9]+)&whichpage=([0-9]+)
RewriteRule ^forum.asp$ /forum/index.php [R=301,L,QSA]
RewriteCond %{QUERY_STRING} whichpage=([0-9]+)
RewriteRule ^forum.asp$ /forum/index.php [R=301,L,QSA]
RewriteCond %{QUERY_STRING} ^showtopic\=213083\&TOPIC_ID\=([^&]+)$
RewriteRule ^$ /forum/index.php? [R=301,L]
RewriteRule ^forum.asp$ /forum/index.php [R=301,L,QSA]
</IfModule>
I ran a headers tool and this is what I got back.
1. Requesting: http://example.com/forum
HEAD /forum HTTP/1.1
Connection: Keep-Alive
Keep-Alive: 300
Accept:*/*
Host: example.com
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Server Response: 301 Moved Permanently
Date: Sun, 06 Jan 2008 19:52:24 GMT
Server: Apache/2.2.3 (Red Hat)
Location: http://example.com/forum/
Connection: close
Content-Type: text/html; charset=iso-8859-1
Redirecting to http://example.com/forum/ ...
2. Requesting: http://example.com/forum/
HEAD /forum/ HTTP/1.1
Connection: Keep-Alive
Keep-Alive: 300
Accept:*/*
Host: example.com
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Server Response: 500 Internal Server Error
Date: Sun, 06 Jan 2008 19:52:24 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.4
Connection: close
Content-Type: text/html
This is an example of the old URL it is trying to spider and I was trying to 301 redirect.
http://www.example.com/forum/forum.asp?FORUM_ID=2&whichpage=10
Thanks for any help here!
You must also explicitly clear the query string by appending a "?" to the substitution URL -- again to prevent redirection loops.
Finally, your rules are not in the correct order, which may also cause problems. Put the most-specific rules first.
Options +FollowSymLinks +Indexes
RewriteEngine on
#
RewriteCond %{QUERY_STRING} ^showtopic\=213083\&TOPIC_ID\=([^&]+)$
RewriteRule ^$ /forum/index.php? [R=301,L]
#
RewriteCond %{QUERY_STRING} TOPIC_ID=([0-9]+)
RewriteRule ^topic.asp$ /forum/index.php?showtopic=%1 [R=301,L]
#
RewriteCond %{QUERY_STRING} ^TOPIC_ID=([0-9]+)&whichpage=([0-9]+)
RewriteRule ^forum.asp$ /forum/index.php? [R=301,L]
#
RewriteCond %{QUERY_STRING} FORUM_ID=([0-9]+)
RewriteRule ^forum.asp$ /forum/index.php? [R=301,L]
#
RewriteCond %{QUERY_STRING} whichpage=([0-9]+)
RewriteRule ^forum.asp$ /forum/index.php? [R=301,L]
#
RewriteRule ^forum.asp$ /forum/index.php [R=301,L,QSA]
Jim
[Sun Jan 6 22:21:37 2008] [error] [client 64.***.12.34] mod_rewrite: Maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if necessary.
In this case, the 'correct page' may be returned to the client, but with a 500 status.
You may get a different error message, but it is unmistakably an error message, and as shown, often gives some idea of both the exact cause of the problem and a suggested fix (although not a very good one in this case).
If you are not seeing an explicit [error] message, then you're not looking at the error log file, and without that information, we can be of very little help here.
Jim