homepage Welcome to WebmasterWorld Guest from 54.161.192.130
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
redirect question: could be a problem
Ecommerce
mcjohnson

10+ Year Member



 
Msg#: 3540875 posted 3:21 am on Jan 5, 2008 (gmt 0)

Friends -

Here's my issue. I have an installation of a popular shopping cart. That cart generates the products in the format of /product.php pages w/ the specific product ID attached. (i.e. www.mysite.com/product.php?ID234)

I have rewritten the cart extensively because the client needed a very highly customized shopping process. Now, the customer is directed to a new page, /product1.php which servers up the proper options for checking out.

However, Google is still indexing the cart and all of the products with the /product.php extention.

I am wondering if its possible to write a redirect that, if clicked from an external referrer, redirects any product.php page to the exact same page, exept as product1.php.

Possible?

If so, is it is possible to leave the INTERNAL workings of the cart unaffected? That is, some pages DO start with product.php and should be left along. It's just the ones coming from google search that I need to redirect.

Is this possibe?

pat

 

jdMorgan

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



 
Msg#: 3540875 posted 3:48 am on Jan 5, 2008 (gmt 0)

It's a rather big mistake to redirect anything just because the script changed. Why give up all of the nicely-indexed pages already in search engines?

Best practice? Never, ever change a URL unless a lawsuit forces you to do so, and never return a 404-Not Found for any URL that has ever been valid on your site. Either serve a genuine replacement page, or return a 410-Gone.

Now, to answer your question, yes it is possible, and not very difficult. You will need to use mod_rewrite, use a RewriteCond directive to check the %{HTTP_REFERER} variable for search engine referrals, simply pass the query string through, which is the default behaviour of mod_rewrite, and Redirect from product.php to product1.php

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

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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved