Hanif Formoly
Hanif Formoly

Reputation: 319

Base directory of my website is accessible and that is public, how to hide from public?

I am quite new in Laravel PHP framework. I had a project and successfully completed and right now it's in production (online sever). but today I saw that everyone can access the base directory of site by just adding a slash to search string and folder name.

For example, if someone type like this

www.mywebsite.com

the page is working properly and all user access are working.

but when someone type like this

www.mywebsite.com/pages

They can access all my pages stored in the folder. All php files which are secrete and must not be viewed publicly. Actually I am storing some pages in the folder (pages).

This is a screen shot. Displaying files in the directory which is not public.

enter image description here

I know, I am missing a small thing, but I don't know how to get that.

Upvotes: 1

Views: 145

Answers (2)

Hossain Azad
Hossain Azad

Reputation: 62

Put a 404.blade.php file in your resource/views/errors folder

if it does not work then stop Auto Directory Index from your hosting.

You can try this .htaccess to prevent Auto Index

IndexIgnore * 

I hope it will work

Upvotes: 1

aimme
aimme

Reputation: 6773

where is you index.php file? put index.php inside the public folder. also .htaccess should be there too with appropriate settings.

Upvotes: 0

Related Questions