Forum Moderators: phranque

Message Too Old, No Replies

Is this a bad rewrite shortcut ?

Multiple-URL matching pattern

         

Buster13

3:25 pm on Nov 30, 2009 (gmt 0)

10+ Year Member



I used the OR operand and made this shortcut rule,

#List of 5 redirects for Google Adwords

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
RewriteRule ^shop/buy-apparel-clothing-shirts\.html$¦^shop/new-wholesale-accessories-clothes\.html$¦^shop/free-posted-shipping-services\.html¦^shop/singapore-online-shopping-business\.html¦^shop/women-fashion-dresses-bags\.html$ http://www.example.com/shop/ [R=301,L]

Basically, it redirect 5 different 'fake' URLs for Adwords to http://www.example.com/shop/

Is it ok i do it this way OR i should have 5 separate URL rewrite rule for each fake URL?

[edited by: jdMorgan at 5:22 pm (utc) on Nov. 30, 2009]
[edit reason] example.com [/edit]

jdMorgan

5:28 pm on Nov 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




RewriteRule ^shop/(buy-apparel-clothing-shirts¦new-wholesale-accessories-clothes¦free-posted-shipping-services¦singapore-online-shopping-business¦women-fashion-dresses-bags)\.html$ http://www.example.com/shop/ [R=301,L]

would certainly be more efficient...

Replace all broken pipe "¦" characters in code found here with solid pipes before use; Posting on this forum modifies the pipe characters.

Note that SEO-wise, it's not a good idea in general to redirect a lot of URLs to your home page; If these pages have been removed and no direct replacement page is available, then a proper 410-Gone response is preferred. The custom error page for 410-Gone should contain -at a minimum- a short, friendly, and somewhat apologetic explanation that the page has been intentionally removed, and text links to your home page, HTML site map, relevant product category pages, and your site-search facility, as applicable.

This may not apply to your current situation if you're doing this so that you can 'track' incoming Adwords clicks by their URLs, but is a more-general rule for replacing 'real' page URLs.

Also, consider that you might be able to simply use 'fake' query strings for your 'fake' URLs, in which case you would not necessarily need to redirect these requests at all:

Example Adword URL: http://www.example.com/shop/?ga=singapore-fashion

Jim

Buster13

5:42 am on Dec 1, 2009 (gmt 0)

10+ Year Member



Thanks for the reply 410 Gone code is new to me. I've learnt one more thing from you yet again!

But like you mention, i am trying to fake Adwords in my situation so 410 does not apply to me. Anyway, I have changed my code to your 'efficient' code as per your advice.

Thanks you!