An Entrepreneur, Coach, IT Consultant, Strategic Adviser, and a Traveler craving to explore and contribute to forming a better society.

Tuesday, December 2, 2008

Preventing Java Script (js) files to be viewed by Users

No comments :
Keywords: .htaccess, Apache, LAMP, WAMP, MAMP, SAMP, PHP, MySQL, Website, Javascript, Preventing JS files

Question: Sometimes you wish your precious code shouldn't be shared with others?

if your answer to the above question is, Yes?

The following lines will prevent the users viewing the JS (javascript) files of your application/website. It shall be added to your ".htaccess" file

Options -Indexes

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://localhost/.*$ [NC]
RewriteRule \.(js|css)$ - [F]

For more information on .htaccess file, click thro the following link: 

No comments :