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

Apache Web Server Forum

    
rewrite for removing session ids
bucklersbury




msg:1505896
 11:06 am on Nov 3, 2004 (gmt 0)

Just read this useful thread on this topic at: [webmasterworld.com...]

My problem is similar - I need to remove session ids for all spiders for all asp pages (we aer using IISRewrite, which uses same syntax as mod-rewrite).

Is this the correct syntax? I have set the user agent to opera just for testing.

RewriteCond %{HTTP_USER_AGENT} ^Opera.*
RewriteCond %{QUERY_STRING}browser_id=[0-9a-z]{2,5}&(.*)$
RewriteRule .*\.asp .*\.asp?%1 [L]

Thanks.

 

bucklersbury




msg:1505897
 11:25 am on Nov 3, 2004 (gmt 0)

Just realised would this be considered as cloaking?

trillianjedi




msg:1505898
 11:33 am on Nov 3, 2004 (gmt 0)

Just realised would this be considered as cloaking?

Removing a session ID is not cloaking. Cloaking is where you serve one page to a user, and another to a spider.

You are serving the same page, just ensuring that the search engines do not index multiple copies.

TJ

bucklersbury




msg:1505899
 12:05 pm on Nov 3, 2004 (gmt 0)

Thanks - is my syntax correct for me to achieve what I am trying to do?

jdMorgan




msg:1505900
 9:04 pm on Nov 3, 2004 (gmt 0)

If I understand your goal, it is to drop the "browser_id" parameter, and keep all parameters that follow, if the requesting user_agent is Opera/.

If that's the case, the following will work in .htaccess on Apache:

RewriteCond %{HTTP_USER_AGENT} ^Opera/
RewriteCond %{QUERY_STRING} ^browser_id=[0-9a-z]{2,5}&(.*)$
RewriteRule ^(.*)\.asp$ /$1.asp?%1 [L]

And here's a speed-up:

RewriteCond %{HTTP_USER_AGENT} ^Opera/
RewriteCond %{QUERY_STRING} ^browser_id=[^&]+&(.*)$
RewriteRule ^(.*)\.asp$ /$1.asp?%1 [L]

Caution: There are some syntax differences between mod_rewrite and ISAPI Rewrite.

Jim

bucklersbury




msg:1505901
 9:26 am on Nov 4, 2004 (gmt 0)

Jim,

Thanks for this - do you think this will work with IASPI rewrite?

Wil test this this afternoon - will let you know how it goes!

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved