Allow and deny access from a referrer site problem

Using a single web hosting account to host multiple sites

Allow and deny access from a referrer site problem

Postby huyhoa » Fri Mar 20, 2009 6:52 pm

I have 2 sites. abc.com and 123.com
123.com i hosted files and abc.com is scripts site (this run my site)
In abc.com i have a script call download.php. This scripts will get the download link from database and display to download.
Now, I want deny all access to file at 123.com if the referrer is empty or is not abc.com and only accepted download (http) if referrer is 123.com
Then, i use this code:

Code: Select all
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?123\.com [NC]
RewriteRule \.mp3$ - [F]



But it doesnt work.
It display 500 error.

Do you have any other option about this?

PS: my site run on linux host server and accepted mod rewrite with no limited anything
huyhoa
 
Posts: 35
Joined: Tue Nov 28, 2006 2:25 am

Postby richardk » Sat Mar 21, 2009 2:18 pm

What does your error log say is causing the error?

Try
Code: Select all
Options +FollowSymlinks

RewriteEngine On

RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com(/.*)?$ [NC]
RewriteRule \.mp3$ - [F,L]

Also try removing the Options line.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby huyhoa » Sat Mar 21, 2009 6:19 pm

Thanks richard

Its display 500 error
I'm at work now, i will try yours when going home.
Best regards,
huyhoa
 
Posts: 35
Joined: Tue Nov 28, 2006 2:25 am

Postby richardk » Sun Mar 22, 2009 11:07 am

Its display 500 error

You already said that. What does your ERROR_LOG say is causing the error?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 16 guests

cron