Welcome to WebmasterWorld Guest from 100.26.182.28

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP referring URL problem

     
1:23 pm on Dec 2, 2005 (gmt 0)

New User

10+ Year Member

joined:July 12, 2005
posts:13
votes: 0


Hi,

Lets say I have a user who searches on google for blue widgets.

there URL then says -
[google.com...]

Now they click on googles link to my website (http://www.mydomain.com)

Is it possible to code into index.php so that when the user clicks on my site link, they are taken to the specific page they want based on the referring url from google?

like in the above example, they search for "blue widgets", so the referring URL is [google.com...] and I want them to go to my blue widgets page (ie. [mydomain.com...]

Is this possible?

3:37 pm on Dec 2, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 13, 2003
posts:775
votes: 0


Hi Lionor,

The most common way to do this is using mod_rewrite so that the path gets sent as a variable to index.php. Something like RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]. Now inside your index.php you'll have a variable $_GET['path'] = blue-widgets. It gives you a lot of control over your content.

It has nothing to do with the google referer. Simply build a good page on blue widgets and they will come.

Tim

4:07 pm on Dec 2, 2005 (gmt 0)

Senior Member from US 

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

joined:Dec 9, 2003
posts:3416
votes: 0


So your home page is ranking for terms it isn't even targeted for? That must be a nice problem to have. :)

You may find the code in msg #19 in the PHP Bag O' Tricks II thread [webmasterworld.com] to be of use.

1:02 am on Dec 3, 2005 (gmt 0)

New User

10+ Year Member

joined:Apr 2, 2005
posts:27
votes: 0


Hi Lionor,
This should do the trick:


if ((isset($_SERVER['HTTP_REFERER'])) and ($_SERVER['HTTP_REFERER']!= '')) {
$keywords = "";
$url = urldecode($_SERVER['HTTP_REFERER']);

// Google
if (eregi("www\.google",$url)) {
preg_match("'(\?&)q=(.*?)(&$)'si", " $url ", $keywords);
$search_engine = 'Google';
}

// Yahoo
if ((eregi("yahoo\.com",$url)) or (eregi("search\.yahoo",$url))) {
preg_match("'(\?&)p=(.*?)(&$)'si", " $url ", $keywords);
$search_engine = 'Yahoo';
}

// MSN
if (eregi("search\.msn",$url)) {
preg_match("'(\?&)q=(.*?)(&$)'si", " $url ", $keywords);
$search_engine = 'MSN';
}

// AllTheWeb
if (eregi("www\.alltheweb",$url)) {
preg_match("'(\?&)q=(.*?)(&$)'si", " $url ", $keywords);
$search_engine = 'AllTheWeb';
}

// Looksmart
if (eregi("looksmart\.com",$url)) {
preg_match("'(\?&)qt=(.*?)(&$)'si", " $url ", $keywords);
$search_engine = 'Looksmart';
}

if (($keywords[2]!= '') and ($keywords[2]!= ' ')) {
$keywords = preg_replace('/"\'/', '', $keywords[2]); // Remove quotes
}
echo $keywords;
echo $search_engine;
}

We have some pages that change so rapidly that if a user comes from a search engine we can be 99% sure that what they are looking for isn't on that page anymore, so we give them a top 5 of items matching their keywords.

-
Niels

1:03 pm on Dec 3, 2005 (gmt 0)

Full Member

10+ Year Member

joined:May 21, 2003
posts:255
votes: 0


Could this be perceived by the search engines as "cloaking", because the spider sees one page called index.html, while the visitor sees a different page on clicking index.html.
2:31 pm on Dec 3, 2005 (gmt 0)

New User

10+ Year Member

joined:Apr 2, 2005
posts:27
votes: 0


I don't think the search engines will ever know, but yes its cloaking.

Similar techniques are used on a lot of websites, with cookies for example: "A week ago you bought this, you might like this to".

Its interesting cous when is it "bad" cloaking or adding value with helping visitors.

-
Niels

10:07 pm on Dec 3, 2005 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15756
votes: 0


it is cloaking, well more specifically, user-agent delivery.

if the engines found out you would be in violation of their terms of service

now, that doesn't mean I think there is anything wrong with cloaking but this is very simple cloaking and not so hard to find out.

I just want to be sure that people understand this before they employ cloaking techniques on sites. I don't want people to come back in 6 months and complain about being banned and they don't know why. ;)

now as to the problem, I am not totally sure this is a great idea to redirect your users, also, if you are ranking a page for a keyword that the page isn't truly targetted for then methinks something else is going on.

10:51 pm on Dec 3, 2005 (gmt 0)

New User

10+ Year Member

joined:Apr 2, 2005
posts:27
votes: 0


True, i disabled the script, however my intentions where good.

I never realised that a competitor could report it as cloaking, maybe they already have.

As for the ranking for a keyword that the page isn't targeted for: these pages have no fixed content, they display a list of new items on the site, much like the headlines on webmastersworld only at a rate of 500-1000 a day.

Its funny how you can be so happy about a solution that you stop thinking about the possible consequences.

Thanks for the reply :)

3:27 am on Dec 4, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 13, 2003
posts:775
votes: 0


I didn't think the original post was talking about cloaking but I could be wrong. I thought he was simply asking how to dynamically generate a site using just the index.php file - which is not cloaking.

Tim

6:18 am on Dec 4, 2005 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15756
votes: 0


I didn't think so either Timotheos, sorry if I was confusing niels

Don't worry niels what you are talking about isn't cloaking, some of the solutions offered were and those were what I was speaking about

>> 500 - 1000 a day

wow

how many pages?

I would try to get the content a little more static, maybe do groups of related products rotated through on any single page and have some static content that can better target the page. Then the ranked page should take care of itself and come up for the appropriate term as opposed to trying to jump them in to the right page. Users don't like getting bounced around much and it could cause ranking issues with engines at some point. If every time an engine spiders a given page the content is totally different I think it would be hard to maintain any rank for that page on a given term.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members