Welcome to WebmasterWorld Guest from 54.167.83.224

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

rewrite for removing session ids

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

New User

10+ Year Member

joined:Sept 20, 2004
posts:17
votes: 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.

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

New User

10+ Year Member

joined:Sept 20, 2004
posts:17
votes: 0


Just realised would this be considered as cloaking?
11:33 am on Nov 3, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member trillianjedi is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 15, 2003
posts:7242
votes: 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

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

New User

10+ Year Member

joined:Sept 20, 2004
posts:17
votes: 0


Thanks - is my syntax correct for me to achieve what I am trying to do?
9:04 pm on Nov 3, 2004 (gmt 0)

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 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

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

New User

10+ Year Member

joined:Sept 20, 2004
posts:17
votes: 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!