haracath
Sep 14 2009, 09:19 AM
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
Sep 29 2011, 07:02 AM
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
Sep 29 2011, 07:13 PM
for that its in .htaccess cause you can not mod the httpd.conf