Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

foxdevuz's avatar

Forbidden You don't have permission to access / on this server.

I uploaded my laravel peoject to hosting and i got

Forbidden
You don't have permission to access / on this server.

in my htaccess file:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Server apache, PHP 8.2.4. what should i do to fix it?

0 likes
6 replies
LaryAI's avatar
Level 58

This error message usually occurs when the server does not have permission to access the requested file or directory. Here are some steps to try to fix the issue:

  1. Check the file and directory permissions: Make sure that the files and directories have the correct permissions. The recommended permissions for Laravel files and directories are 755 for directories and 644 for files. You can change the permissions using an FTP client or the command line.

  2. Check the ownership of the files and directories: Make sure that the files and directories are owned by the correct user and group. The recommended user and group for Laravel files and directories are the same as the web server user and group. You can change the ownership using the command line.

  3. Check the Apache configuration: Make sure that the Apache configuration allows access to the directory where your Laravel project is located. You can check the Apache configuration files to see if there are any restrictions or rules that prevent access to the directory.

  4. Check the .htaccess file: Make sure that the .htaccess file is located in the correct directory and has the correct content. The .htaccess file should be located in the public directory of your Laravel project and should contain the code provided in the question.

If none of these steps work, you can try contacting your hosting provider for assistance.

Example of changing file permissions using the command line:

chmod -R 755 /path/to/directory
chmod -R 644 /path/to/files

Example of changing ownership using the command line:

chown -R apache:apache /path/to/directory
chown -R apache:apache /path/to/files
foxdevuz's avatar

@Snapey i set 644 to files 755 to Folder but still i'm getting this error

jaseofspades88's avatar

@foxdevuz - the only logical reason I can imagine that you or your client is using a server to which you don't have ssh access, is because of the 'costs'. I would advise there are plenty of budgeted hosting options that you could move to, that will help you out a lot more down the road.

Please or to participate in this conversation.