Hi Guys
Firstly, I am clearly not too savvy with rewrite rules, and am learning lot with this project. Currently, we are trying to block hot-linking and direct links to .png and .flv files on our website, with little success.
I am using the rules below in the httpd.conf, rather than using a .htaccess file. But, even with a .htaccess I can still download the files using the direct URL and can even embed the files on another website.
/usr/local/etc/apache/httpd.conf
Having spoken to a few people and looked all over the net these rules 'should' work. Have I done something dumb/wrong?
Thanks
Firstly, I am clearly not too savvy with rewrite rules, and am learning lot with this project. Currently, we are trying to block hot-linking and direct links to .png and .flv files on our website, with little success.
I am using the rules below in the httpd.conf, rather than using a .htaccess file. But, even with a .htaccess I can still download the files using the direct URL and can even embed the files on another website.
/usr/local/etc/apache/httpd.conf
Code:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/usr/local/www/data">
## This Configuration works 100%, though it may have unnecessary rules.
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex index.php index.html index.htm
ServerSignature Off
AddType video/x-flv .flv
AddType application/x-shockwave-flash .swf
AddType image/x-icon .ico
AddDefaultCharset UTF-8
DefaultLanguage en-US
SetEnv TZ Australia/Melbourne
SetEnv SERVER_ADMIN ghostcorps at mail.com
# HEADERS and CACHING
##############################################
#### CACHING ####
##### YEAR
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
##### WEEK
<FilesMatch "\.(js|css|pdf|swf)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
##### 10 minutes
<FilesMatch "\.(html|htm|txt)$">
Header set Cache-Control "max-age=600"
</FilesMatch>
#### DONT CACHE
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
## URL rewriting rules work 100%
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
## Hotlink blocking rules work %0
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?website\.com\.au/ [NC]
RewriteRule .*\.(png|flv)$ website.com.au [R,NC]
</Directory>
Having spoken to a few people and looked all over the net these rules 'should' work. Have I done something dumb/wrong?
Thanks