homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
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...

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


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)

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)

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]


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