Forum Moderators: phranque
In reality, the tag urls are of this format:
http://example.com/index.php?tag=example
I've since corrected the sitemap generator so that its tag urls are of the correct format, but Google has already indexed some of the bad urls. I'd like to redirect bad url to good url while preserving the query string.
I tried a number of things and this is what makes the most sense to me, but it doesn't work:
RewriteRule ^blog/index\.php\?$ index.php? [R=301,QSA,L]
Any suggestions? Thanks in advance!
Jacob
[edited by: jdMorgan at 5:38 pm (utc) on Mar. 13, 2007]
[edit reason] No sigs or URLs, please. See TOS. [/edit]
RewriteCond %{QUERY_STRING} ^tag=example$
RewriteRule ^blog/index\.php$ http://www.example.com/index.php?different_name=value [R=301,L]
RewriteCond %{QUERY_STRING} ^tag=example$
RewriteRule ^blog/index\.php$ http://www.example.com/index.php [R=301,L]
RewriteRule ^blog/index\.php$ http://www.example.com/index.php [R=301,L]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim
RewriteCond %{QUERY_STRING} &?tag=[^&]*
RewriteRule ^blog/index\.php$ http://www.example.com/index.php [R=301,NC,L]
Again, use a full URL for the substitution path, and there is no need to include the [QSA] flag -- It is completely redundant in this case.
Jim