Welcome to WebmasterWorld Guest from 54.196.238.210

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

help with simple htaccess code

getting the correct code...

     

jmdb71

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

10+ Year Member



Hi,

I want to redirect gone all pages that contain

*whatever*.html?sort=*whatever*

for example

mypage.html?sort=3d&filter=4
anotherpage.html?sort=1a
etc.

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!

jdMorgan

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.

Jim

jmdb71

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

(WHATEVER).html?sort=(WHATEVER)

chirp

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

10+ Year Member



Closer. Try this one for size:

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

;)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month