Help - Search - Members - Calendar
Full Version: How To Prevent Deep Linking To My Website
Zymic Webmaster Forums > Web Design & Development > General Web Design Discussion
haracath


I own a website which contain a forum of my website. The problem I'm facing is that people'll taking the direct links of myforum and insert hyperlink in to their site. I am getting a huge amount of bandwidth and that's ok, but the number of pages visited is low in my main site. Is there a way or a script that I can add to the links, so that when someone presses on the link from their website, a page from my website opens instead or they cannot link to myforum, so I can get more visits. I using php, Please write to help me a script or code ...and show me where can I insert it?

Thanks!
cashloan
Your site is hosted by an Apache web server, so you should be able to do the following in your site's httpd.conf (or virtual host block)

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/.*$ [NC]
RewriteRule ^/PublicFiles/*$ /page-about-direct-links.html

That is basically saying:

1. Turn the mod_rewrite engine on
2. If the HTTP Referrer is blank...
3. Or doesn't contain my domain name...
4. Or doesn't contain my domain name without wwww...
5. Redirect any requests for anything under /PublicFiles/ to /page-about-direct-links.html
ssfdre38
for that its in .htaccess cause you can not mod the httpd.conf
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.