質問

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