Hi,
I'm trying to work out how to setup a rule that I can put in the htaccess file for a particular directory, so that the files within can only be viewed if the request (link) to open the file came from within my website.
e.g. would only open if linked to from any page in the or website.
i.e. if you tried to navigate to the page directly by typing the URL in, it wouldn't open.
I presume that I'd have to have a rule setup looking at the http referrer... I tried this, but it doesn't work (I get a 403 forbidden error whether I use the link from within the site, or just type the URL in manually). I've obviously got something wrong...
Any help gratefully received.
Regards,
Chris.
I'm trying to work out how to setup a rule that I can put in the htaccess file for a particular directory, so that the files within can only be viewed if the request (link) to open the file came from within my website.
e.g. would only open if linked to from any page in the or website.
i.e. if you tried to navigate to the page directly by typing the URL in, it wouldn't open.
I presume that I'd have to have a rule setup looking at the http referrer... I tried this, but it doesn't work (I get a 403 forbidden error whether I use the link from within the site, or just type the URL in manually). I've obviously got something wrong...
Code:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} !^[URL unfurl="true"]http://test.example\.co.uk/[/URL] [NC]
RewriteCond %{HTTP_REFERER} !^[URL unfurl="true"]http://example\.co.uk/[/URL] [NC]
RewriteRule ^.*$ [URL unfurl="true"]http://www.example.co.uk/not_allowed_here.htm[/URL] [R=301,L]
Any help gratefully received.
Regards,
Chris.