tnichols
tnichols

Reputation: 635

Redirect users from the webroot in cakephp

I am trying to go through the deployment process with a cakePHP application. I am struggling to figure out how to disable access to my webroot folders.

For instance, I have all the images for the site in webroot/images

If a user tries to access this page as a URL it allows them to see a list of all the images used throughout the site. Same thing with webroot/js, webroot/css, etc.

How do I disable access to those folders through the URL?

Thanks!

Upvotes: 1

Views: 1070

Answers (1)

floriank
floriank

Reputation: 25698

You want to disable directory listing? Or deny access to the images itself?

Apache: http://www.htaccess-guide.com/disable-directory-listings/

Nginx: http://nginxlibrary.com/enable-directory-listing/

The link for nginx is about how to enable it but well, the only difference would be the on/off setting.

If you want to avoid that a user can directly access the images you'll have to pass them through a script (check the CakePHP MediaView class) and not put them into the webroot.

Upvotes: 2

Related Questions