homepage Welcome to WebmasterWorld Guest from 54.205.207.53
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
help with simple htaccess code
getting the correct code...
jmdb71

10+ Year Member



 
Msg#: 4961 posted 6:06 pm on Nov 9, 2005 (gmt 0)

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

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



 
Msg#: 4961 posted 8:39 pm on Nov 9, 2005 (gmt 0)

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

10+ Year Member



 
Msg#: 4961 posted 8:54 pm on Nov 9, 2005 (gmt 0)

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

10+ Year Member



 
Msg#: 4961 posted 2:30 pm on Nov 10, 2005 (gmt 0)

Closer. Try this one for size:

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

;)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved