问题
I am new to Laravel4, I was trying to run laravel4 on a shared hosting.Since I dont have root access, to avoid public in my url. I have moved all the contents in the public directory to "public_html" folder.
Then I changed the locations in respective files. But when I visited url "abc.com/myapp/app", it lists all the folders and files under app directory. Since it exposes the project files, I was looking to avoid the same.
In CodeIgniter if we try to access folders like this it gives message
"Directory access is forbidden."
Edit:
I have added
Options All FollowSymLinks MultiViews -Indexes
in a .htaccess file in the app folder as per suggested by @valey viktorovsky
回答1:
There are multiple methods...
The easy one:
If you have access to .htaccess file and you can modify it, place this little code
Options -Indexes
Annoying one
If you cannot create/modify .htaccess file, create index.html
file inside each folder you would like to protect
来源:https://stackoverflow.com/questions/17720947/how-to-avoid-directory-listing-in-laravel-4