Mobile app version of vmapp.org
Login or Join
Tiffany637

: How to prevent a specific website from linking to our domain? We have a landing page which is used only for running an ad campaign. There is a website that has found this link somehow and

@Tiffany637

Posted in: #Htaccess #Linux

We have a landing page which is used only for running an ad campaign. There is a website that has found this link somehow and is linking to it. I've been told by marketing they don't want that website linking to the landing page. How can I prevent a specific website from linking to our domain? I don't want to block all websites from linking to it, just this specific one. Is there solution something to do with .htaccess? If so, please provide an example of doing this or a link to example because I've been unable to find one.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Tiffany637

2 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn148

www.javascriptkit.com/howto/htaccess10.shtml

In the webmaster community, "hot linking" is a curse phrase. Also
known as "bandwidth stealing" by the angry site owner, it refers to
linking directly to non-html objects not on one own's server, such as
images, .js files etc. The victim's server in this case is robbed of
bandwidth (and in turn money) as the violator enjoys showing content
without having to pay for its deliverance. The most common practice of
hot linking pertains to another site's images.

Using .htaccess, you can disallow hot linking on your server, so those
attempting to link to an image or CSS file on your site, for example,
is either blocked (failed request, such as a broken image) or served a
different content (ie: an image of an angry man) . Note that
mod_rewrite needs to be enabled on your server in order for this
aspect of .htaccess to work. Inquire your web host regarding this.

With all the pieces in place, here's how to disable hot linking of
certain file types on your site, in the case below, images, JavaScript
(js) and CSS (css) files on your site. Simply add the below code to
your .htaccess file, and upload the file either to your root
directory, or a particular subdirectory to localize the effect to just
one section of your site:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com/.*$ [NC]
RewriteRule .(gif|jpg|js|css)$ - [F]



Be sure to replace "mydomain.com" with your own. The above code
creates a failed request when hot linking of the specified file types
occurs. In the case of images, a broken image is shown instead.
Serving alternate content when hot linking is detected

You can set up your .htaccess file to actually serve up different
content when hot linking occurs. This is more commonly done with
images, such as serving up an Angry Man image in place of the hot
linked one. The code for this is:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com/.*$ [NC]
RewriteRule .(gif|jpg)$ www.mydomain.com/angryman.gif [R,L]

10% popularity Vote Up Vote Down


 

@Gretchen104

You can't stop a site linking to you with technical measures, but you can identify requests which have come from that site/url and block these in .htaccess -


RewriteEngine on
RewriteCond%{HTTP_REFERER} ^http://www.site.com [NC]
RewriteRule index.html www.go-away.com/goaway.html [R]


The above rules will probably need some tweeking, but the idea is to match the REFERER (yes, that spelling is correct) - in this case where the referer starts with www.site.com - and then if they land on index.html redirect them to the url goaway.html)

If you REALLY want to attempt to stop them from linking to you, I'd suggest finding out who they are and getting a lawyer to write a letter. Then follow it up with legal action if you can find grounds to.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme