Forum Moderators: phranque

Message Too Old, No Replies

Is it a good idea to protect js/css files?

Using RewriteCond {HTTP_REFERER}

         

iProgram

7:38 am on Oct 15, 2004 (gmt 0)

10+ Year Member



Just like the method used to protect images, the following code can protect your js/css files from being viewed outside your website:

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^http ://domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http ://domain.com$ [NC]
RewriteCond %{HTTP_REFERER}!^http ://www.domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http ://www.domain.com$ [NC]
RewriteRule .*\.(css¦js)$ - [F,NC]

If you have experience of "web cloned/downloaded by an idiot", you will understand how important it is.

Is there any potential trouble here? Btw, I designed my website using XHTML+CSS, the major designing works are in CSS files.