Zen Cart Logo
Forums / General Questions / 301 redirect and message to referrer help?

301 redirect and message to referrer help?

Views: 1,857

Results 1 to 3 of 3
12 Nov 2011, 1:03 PM
#1
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

301 redirect and message to referrer help?

im closing down my old shop livvylou.co.uk, as i have merged my products on my new site livvylougifts.co.uk

i have placed the following redirect on my old site

Redirect 301 / http://www.livvylougifts.co.uk/index.php?main_page=index&cPath=62

(i haven't got a like for like so i am simply diverting all traffic from the old to a category which is relevant to the previous content.)

i would like to set up a notice that welcomes old traffic to the new page, in my understanding a 301 redirect should includes the referrer (in this case my old site)

so i have used the code

<!-- old livvylou site welcome -->
<?php

$ref=$_SERVER['HTTP_REFERER'];
$domain_search = "livvylou.co.uk";
$ref_site = parse_url($ref, PHP_URL_HOST);

if (preg_match("/$domain_search/i" , $ref_site))
{
echo "Exciting news!!!! Livvylou.co.uk and Livvylou Gifts have now merged to make large convenient place for you to find all your children's goodies. We have directede you to our baby and child gifts but we also have lots more categories now for personalised giftware. Thanks for stopping by!";
}

?>
<!-- old livvylou site welcome -->

but this isnt working, are there any 301 gurus who can help out please? its quite urgent :)

thanks in advance

12 Nov 2011, 8:26 PM
#2
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: 301 redirect and message to referrer help?

I would dispense with stating anything on the old site and go right to the new.

Put this code in the main .htaccess file on the old site.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^livvylou.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.livvylou.co.uk$
RewriteRule ^(.*)$ "http://livvylougifts.co.uk\new_site_message.html" [R=301,L]

On the new site create a file called "new_site_message.html" stating what has happened and provide a link to the Home page of your new site.

13 Nov 2011, 10:51 AM
#3
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: 301 redirect and message to referrer help?

ah thats brill! seems a lot easier too, thanks for the reply!