Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Allow Access From Webserver, Block from HTTP |
|
Author |
|
TehTotalPwnage
Joined: 13 Mar 2015 Posts: 1 Location: US, El Monte
|
Posted: Fri 13 Mar '15 20:42 Post subject: Allow Access From Webserver, Block from HTTP |
|
|
I want to run an HTML webpage that accesses an MP3 resource that's also on my website. However, I only want the webpage to have access to the file and block access from those attempting to access the file directly. That leaves me with two options:
1. Block access through the Apache configuration so that only my Webserver can access the resource, or
2. Hide the URL in the code.
Anybody know how I can go about doing this? Thanks! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 16 Mar '15 13:01 Post subject: |
|
|
You can try
Code: |
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example.com [NC]
RewriteRule \.(mp3)$ - [NC,F,L]
|
or
Code: |
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example.com [NC]
RewriteRule \.(mp3)$ - [NC,F,L]
|
|
|
Back to top |
|
|
|
|
|
|