FreewayTalk

6 replies to this thread. Most Recent

grantsymon

28 Jun 2019, 7:14 pm

Redirect referrer domain

What’s the best way to redirect hits from a specific domain? Are there any actions that can do this?

Grant

waltd

28 Jun 2019, 8:24 pm

No Actions, but you can do this pretty easily with Apache .htaccess directives. When you say “from a specific domain”, do you mean when people from a certain domain visit your site, or do you mean when a request comes in to your server for a specific domain (assuming you host more than one domain on that one server)?

Walter

On Jun 28, 2019, at 3:14 PM, grantsymon <[email protected]> wrote:

What’s the best way to redirect hits from a specific domain? Are there any actions that can do this?

Freeway user since 1997

http://www.walterdavisstudio.com

grantsymon

29 Jun 2019, 8:02 am

Hi Walter,

thanks for the reply.

The first (‘when people from a certain domain visit your site’).

When someone visits my site from a specific domain, in this case, pinterest, I’d like to automagically direct them to either a specific site or page of my own, or even a specific domain of my own.

Grant

waltd

29 Jun 2019, 8:23 pm

You could try this:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTP_REFERER} ^https?://(www)?.*pinterest\.com.*$  [NC]
 RewriteRule ^(.*)$ <https://some.other.site/$1> [R,L]
</IfModule>

In an .htaccess file. If your host permits an .htaccess file to modify this type of configuration directive, and mod_rewrite is on, you will be all set. If either of those are not true, you can ask your host to enable them, or look in your cPanel to see if they are available to be turned on.

That redirect takes care to send along whatever was after the / to the server you’re redirecting to. You can leave off the $1 if you don’t want to do that.

Walter

On Jun 29, 2019, at 4:02 AM, grantsymon <[email protected]> wrote:

Hi Walter,

thanks for the reply.

The first (‘when people from a certain domain visit your site’).

When someone visits my site from a specific domain, in this case, pinterest, I’d like to automagically direct them to either a specific site or page of my own, or even a specific domain of my own.

Freeway user since 1997

http://www.walterdavisstudio.com

grantsymon

30 Jun 2019, 6:25 pm

Thanks Walter!!

I have used htaccess in the past, so it should work fine. I’ll try it this week … just have to work out how to test it. :) :) :)

Grant

Simon Manning

1 Jul 2019, 10:28 am

You can use curl in Terminal to provide a pretend referer, e.g. something like: curl —referer http://pinterest.com/ireallycamefrompinteresthonest http://your.test.site/something

That’ll spit whatever the server gives back on to Terminal so redirecting to a simple text file(s) rather than full-blown page(s) with lots of HTML will make verifying where you landed less painful.

On Sun, Jun 30, 2019 at 7:25 PM grantsymon <[email protected]> wrote:

Thanks Walter!!

I have used htaccess in the past, so it should work fine. I’ll try it this week … just have to work out how to test it. :) :) :)

Back to Top

waltd

1 Jul 2019, 12:27 pm

Good Idea, Simon! Eva, just a warning if you paid attention in grammar school: don’t spell referrer the usual way, only use one r in the middle, because long ago when they were coming up with these header names, someone wasn’t a good speller, and it stuck.

Walter

On Jul 1, 2019, at 6:28 AM, Simon Manning <[email protected]> wrote:

You can use curl in Terminal to provide a pretend referer, e.g. something like: curl —referer http://pinterest.com/ireallycamefrompinteresthonest http://your.test.site/something

That’ll spit whatever the server gives back on to Terminal so redirecting to a simple text file(s) rather than full-blown page(s) with lots of HTML will make verifying where you landed less painful.

On Sun, Jun 30, 2019 at 7:25 PM grantsymon <[email protected]> wrote:

Thanks Walter!!

I have used htaccess in the past, so it should work fine. I’ll try it this week … just have to work out how to test it. :) :) :)

Freeway user since 1997

http://www.walterdavisstudio.com