SeanJ
SeanJ

Reputation: 1231

Forbidden to access Laravel folder

I created a new blog

Laravel new blog

I changed DocumentRoot to point at the public folder

DocumentRoot /home/XXXX/blog/public

I added a .htaccess file as per this post

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

I added the file to both blog and public folders

But I still get:

Forbidden
You don't have permission to access / on this server.
Apache/2.4.29 (Ubuntu) Server at XX.XXX.167.3X Port 80

As I have installed in a user folder, do I somehow need to set the user of the apache2 engine? A bit lost here, any help appreciated.

Upvotes: 0

Views: 857

Answers (1)

Ismoil  Shifoev
Ismoil Shifoev

Reputation: 6021

permission issue the fix was try this the first solution

sudo chown www-data:www-data -R directory-name

alternative you can create and put this .htaccess file in your laravel installation folder.

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Upvotes: 1

Related Questions