Restrict The Css, Images And Javascript Files

Hi,

I have developed the Yii application and hosted in the server. when I’m entering in the server as like this, www.example.com/css or images or java-script files its visible to all the visiters, i want to display the .


Forbidden

You don't have permission to access /css/ on this server.

error. How to restrict files. please help me :(

If your application is running on Apache server then you may add this to .htaccess:

This will only prevent to list files in a directory, will not block access.




# Disable directory listing, this will show empty page if requesting

# for a existing directory access/view

<IfModule mod_autoindex.c>

	IndexIgnore */*

</IfModule>



If you wish to block access then you should write your own new UrlRule Class and also send css, javascript to client using your own PHP file with Custom Header to handle only when user is logged in.

thanks for the response.

But, i think the above code doesn’t work?