Reputation: 3855
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.
Upvotes: 0
Views: 1423
Reputation: 61
Or just add a .htaccess with :
RewriteEngine On
RewriteRule ^ public [L]
Upvotes: 1
Reputation: 2320
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"
Upvotes: 3