Welcome to WebmasterWorld Guest from 54.163.168.15

Forum Moderators: Ocean10000 & incrediBILL & phranque

rewrite for removing session ids

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

10+ Year Member



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)

10+ Year Member



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

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



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)

10+ Year Member



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

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



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)

10+ Year Member



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!

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month