logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Allow Access From Webserver, Block from HTTP
Author
TehTotalPwnage



Joined: 13 Mar 2015
Posts: 1
Location: US, El Monte

PostPosted: Fri 13 Mar '15 20:42    Post subject: Allow Access From Webserver, Block from HTTP Reply with quote

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

PostPosted: Mon 16 Mar '15 13:01    Post subject: Reply with quote

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


Reply to topic   Topic: Allow Access From Webserver, Block from HTTP View previous topic :: View next topic
Post new topic   Forum Index -> Apache