문제

I'm having a problem with denying access to the root directory of my Laravel Site...

I have my project in xampp/htdocs/laravel

Of course Laravel routes the /public directory...

But how can I deny access to the directory xampp/htdocs/laravel ...? How can I prevent the directory listing?

The only way I've found is putting an index.php with a header("location: /laravel/public")

But I dont know if it's the best way... should I use .htaccess? How? I've tried a few but it results in major errors across the server.

도움이 되었습니까?

해결책

You need to open your httpd.conf file (xampp/apache/conf/httpd.conf) and change the "DocumentRoot" value to include the path to your public folder:

DocumentRoot "C:/xampp/htdocs/laravel/public"

다른 팁

Or just add a .htaccess with :

RewriteEngine On 
RewriteRule ^ public [L]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top