• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

authorized domain check

megacool

New Member
PHP authorized domain check

I used to have this PHP script which would.. check the referring domain (multiple) and if authorized would go on and parse the rest of the page, if not it would just stop there and won't go any further.

can anyone help me find this?
 
Last edited:
You could use .htaccess

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^[url]http://yourdomain.com/.*[/url]$ [NC]
RewriteCond %{HTTP_REFERER} !^[url]http://allowed_domain.com/.*[/url]$ [NC]
RewriteRule .*\.(php)$ - [F]

Change the RewriteRule .*\.(php)$ - [F] to the extension of the pages/files you want to restrict, for multiple files you can use .*\.(php|html|zip|jpg)$ etc ...

Domains not listed there as allowed will be directed to your 403 page
 
Thanks but

see im trying embed it inside a PHP page I have.. I just don't want people coming to it unless they click on a link to my site.
 
Back
Top