Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

help with simple htaccess code

getting the correct code...



6:06 pm on Nov 9, 2005 (gmt 0)

10+ Year Member


I want to redirect gone all pages that contain


for example


It is important that not all pages containing sort= are redirected to gone status, only when they end in .html?sort=

Would this code work:

RewriteRule *.html?sort=* - [G]

i am sure i have an error somewhere, i believe the . wont be interpreted correctly, and not the? because they are special characters. How could i do this?

thanks in advance!


8:39 pm on Nov 9, 2005 (gmt 0)

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

You cannot test a query string with RewriteRule. It has to be tested separately with RewriteCond. See this thread [webmasterworld.com] for an example to use with your (modified) rule.



8:54 pm on Nov 9, 2005 (gmt 0)

10+ Year Member

thanks, so would something like this work?

RewriteCond *.html %{QUERY_STRING} ^sort=*
RewriteRule - [G]

to RedirectGone all pages that contain



2:30 pm on Nov 10, 2005 (gmt 0)

Closer. Try this one for size:

RewriteCond %{QUERY_STRING} ^sort= 
RewriteRule \.html - [G]



Featured Threads

Hot Threads This Week

Hot Threads This Month