Pregunta

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.

¿Fue útil?

Solución

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"

Otros consejos

Or just add a .htaccess with :

RewriteEngine On 
RewriteRule ^ public [L]
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top