Reputation:
As a Google Trusted street view photographer, our company is listed in Google with our website. See it here: Photo of our Google listing
The thing is, we are only allowed to give the homepage link, like www.aemotion.com. But what I want is when visitors click the link on that page only, they will be redirected to this page: http://www.aemotion.com/google-street-view-van-mooi-van/.
I know a normal htaccess redirect will redirect all trafic from the homepage and that's not what we want obviously.
Anybody an idea how to tackle this?
Upvotes: 2
Views: 96
Reputation: 3422
You can use PHP's $_SERVER
variable, so if the user came from http://www.google.nl (I see that you're from the Netherlands) than redirect to that page.
So your code will be:
if($_SERVER['HTTP_REFERER'] == 'http://www.google.nl') {
Header('Location: /google-street-view-van-mooi-van/');
}
You could also use a specific get
variable. For example: http://www.aemotion.com/?reffer=site_name
. After that you can add the follow code:
if(isset($_GET['reffer'])) {
if($_GET['reffer'] == 'site_name') {
Header('Location: /google-street-view-van-mooi-van/';
} else if($_GET['reffer'] == 'site_name_2') {
Header('Location: /google-street-view-van-mooi-van/';
}
}
This works also for multiple sites.
Hope this works!
Hopelijk werkt dit! (in Dutch)
Upvotes: 1
Reputation: 9113
If they pass you a $_GET
variable or $_POST
variable you could check for that and redirect accordingly.
if (isset($_REQUEST['external_redirect'])) {
header("Location: /someOther/location");
exit;
}
Upvotes: 0