[thelist] .htaccess syntax when blocking links from a frame-based website

Jono jono at charlestonwebsolutions.com
Fri Sep 15 13:52:31 CDT 2006


I am using the following .htaccess code to block a referring link that 
is coming to a (client's) website from a website - companyx - that uses 
frames:

 - - - - - - - - - - - -

RewriteEngine on

# Block Specific Site

RewriteCond %{HTTP_REFERER} (companyx\.com) [NC]
  RewriteRule .* - [F]

 - - - - - - - - - - - -

Questions:

1.  Does that syntax look correct?

2.  If  companyx.com uses frames, do I need to add the url for the frame 
that contains the referring link on companyx's site, or is the general 
domain all I need?

3.  If  I do need to block the specific frame, what is the proper syntax 
for a "/" in an .htaccess - I see that ".com" must be written as "\.com" 
is it the same case for a backslash?  Would I use the following: 
companyx\.com\/frame

Something like this:

 - - - - - - - - - - - -

RewriteEngine on

# Block Specific Site

RewriteCond %{HTTP_REFERER} (companyx\.com) [NC, OR]
RewriteCond %{HTTP_REFERER} (companyx\.com\/frame) [NC]
  RewriteRule .* - [F]

 - - - - - - - - - - - -


Thanks,

Jono



More information about the thelist mailing list