Want to keep people from viewing and stealing your template files? Of course, we all do.
Here’s a simple way to keep prying eyes out of your template files and stealing your layout and functions.

In your .htaccess, add the following to the very top:
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 .*.(tpl)$ http://www.domain.com [R,NC]
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 .*.(tpl)$ http://www.domain.com [R,NC]
Replace all cases of domain.com with your domain name.
The last line you can specify where to send the visitor that attempts to view your .tpl file. I would leave it at your main page.
This will keep prying eyes from viewing your .tpl files.
Test it by trying to view my pligg.tpl file at http://www.faqpal.com/templates/yget/pligg.tpl
That’s it.
This is the best way I have come up with to protect your files. Got a better idea, post it below.
How do you protect your files?







