Forum Moderators: phranque

Message Too Old, No Replies

Filtering urls out from standard redirect

How to filter out particular url strings from a 301 non www to ww redirect

         

CainIV

7:43 am on Aug 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi guys. I need to do a sitewide 301 redirect from non www urls to www urls around the board, except for some critical portions of the website which I need to avoid in the ruleset.

The 301 redirect I put in place was fine for the most part, but I found that functionality in both the admin and checkout process were disrupted.

RewriteCond %{HTTP_HOST} ^thissite\.com [NC]
RewriteRule (.*) [thissite.com...] [R=301,L]

inevitably caused errors with checkout urls:

[thissite.com...]

jdMorgan

12:44 pm on Aug 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add a RewriteCond above your rule to exclude that URL:

RewriteCond %{REQUEST_URI} !^/shopping_cart\.html$

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

CainIV

10:13 pm on Aug 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks very much!