• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

Need to filter specific domain in hotlinking rule in htaccess

I have the following code in my .htacess file to prevent hotlinking. However, I now need to allow linking from OTHERDOMAIN.com. I suspect it is a second rule?

RewriteEngine    on
RewriteCond    %{HTTP_REFERER} !^$
RewriteCond    %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?MYDOMAIN\.com [NC]
RewriteRule    \.(gif|jpe?g|png)$ - [F,NC,L]

Many thanks for input,
Paul
0
pcoghlan
Asked:
pcoghlan
1 Solution
 
caterham_wwwCommented:
Just a modification to your condition:

( | stands for "or")
RewriteEngine    on
RewriteCond    %{HTTP_REFERER} !=""
RewriteCond    %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?(MYDOMAIN|OTHERDOMAIN)\.com [NC]
RewriteRule    \.(gif|jpe?g|png)$ - [F,NC,L]

Open in new window

0
 
pcoghlanAuthor Commented:
blimey, that was easy!

Thanks a million

Paul
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now