Preventing viewing css and js files using direct url

I am trying to prevent the direct access to my website resources using htaccess.My website is which is a subfolder.But if i enter in the address bar i can see them.But i want to prevent seeking them and redirect to index.html.

I am trying:

RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?\.ltd [NC] 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?\.ltd.*$ [NC] 
RewriteRule \.(gif|jpg|js|txt|css)$ /HeyManYouHaveComeToAwrongPlace;) [L]

But it blocks all.Even in index.html page show only markups not with stylings. What can be a solve?


Simple Answer: You cannot do that.

If you want the browser to apply CSS to your webpage and execute JavaScript, then you cannot prevent it from the users.

If you manage to block the CSS and JS files, then how will the browser access them?

The most you can do is minify or uglify, which will just make it difficult (not impossible) to view your CSS and JavaScript.

Need Your Help

Slow application while scrolling through the table

objective-c uitableview core-data asynchronous uiimageview

I am new to mobile development. In my application I've got a table which shows the recipes created by the user. A cell is designed as a nib-file with an image (which is asynchronously loaded) and 2