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

Apache Web Server Forum

    
Query String Redirect... How Do I Do It?
Billy Batson

5+ Year Member



 
Msg#: 3793 posted 4:31 am on Jun 10, 2005 (gmt 0)

Over on the Bourbon Update thread Justin was telling me how to 301 a link to the index of mydomain with a long obsolete parameter call on it:


RewriteCond %{HTTP_HOST} ^mydomain\.com\?[parameter] [NC]

You will need to use %{QUERY_STRING}. I would elaborate, but this is an update thread. =)

If you are stuck, please post in the Apache forum.

I'm stuck... how do I do this redirect, please?

Thanks!

 

Billy Batson

5+ Year Member



 
Msg#: 3793 posted 5:05 am on Jun 10, 2005 (gmt 0)

Actually, I think I have solved the issue:

Options +FollowSymLinks
RewriteCond %{query_string} ^aaaa=bbbb.htm
RewriteRule index\.htm$ http://www.example.com/? [R=301,L]

Or is this going to break and make Google angry somehow?

[edited by: jdMorgan at 3:50 pm (utc) on June 10, 2005]
[edit reason] Examplified. [/edit]

jdMorgan

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



 
Msg#: 3793 posted 3:50 pm on Jun 10, 2005 (gmt 0)

It's OK, as long as you're aware that it will redirect index.html in any (sub)directory to your home page.

Since you didn't state what you're trying to accomplish or give background information on your current site structure, I can't say if it will hurt your rankings in Google.

You can make it more specific by start-anchoring the URL pattern. Further, you should escape all literal characters, including those in the query string:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^aaaa=bbbb\.htm
RewriteRule ^index\.htm$ http://www.example.com/? [R=301,L]

That will redirect requests for www.example.com/index.html?aaaa=bbb\.htm to www.example.com/

Jim

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