When I connect from my local machine to a live instance of Magento 2, I get a 403 Error with the following message:


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

Server unable to read htaccess file, denying access to be safe

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Screenshot of 403 error

3 Answers 3


How to fix

In order to resolve the 403 Forbidden problem you have to adjust permissions for user which is used to run localhost server.

  1. Find your username with this command:
  1. Then navigate and check if you have config for this user or create if doesn’t exist:
cd /etc/apache2/user/
touch <username>.conf

Where username is an user name used to run Apache server.

  1. Add the following configuration (note that this is only for Yosamite):
sudo vi /etc/apache2/user/<username>.conf

Add the following content:

<Directory "/Users/<username>/Sites/">
AddLanguage en .en
LanguagePriority en fr de
ForceLanguagePriority Fallback
Options FollowSymlinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from localhost
Require all granted
  1. Add lines in the /etc/apache2/httpd.conf configuration file:
sudo vi /etc/apache2/httpd.conf

Check and uncomment the line:

Include /private/etc/apache2/extra/httpd-userdir.conf
  1. In the httpd-userdir.conf file ensure to uncomment line:
Include /private/etc/apache2/users/*.conf
  1. Restart Apache server
sudo /usr/sbin/httpd -k restart

Enjoy developing your Magento 2 projects.

Source From : maxpronko


This answer assumes that you are running apache 2.4 on ubuntu. Please provide more information about your server.

Solution 1

Check that mod_rewrite is enabled on your server by running sudo a2enmod rewrite.

If mod_rewrite was not already enabled, restart apache by issuing the command sudo systemctl restart apache2.

Solution 2

Ensure that your apache configuration contains the proper configuration. For example, a virtual host configuration for a development deployment might look like this:


<VirtualHost *:80>
    ServerName www.magentowebsite.com
    ServerAlias magentowebsite.com www.magentowebsite.com

    ServerAdmin [email protected]
    DocumentRoot /var/www/magentowebsite.com/public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/magentodev.com/public_html>
            Options Indexes FollowSymLinks Multiviews
            AllowOverride All
            Require all granted
            Order Deny,Allow
            Allow from all

Save the file and ensure that the website is properly enabled by issuing the command:

$ sudo ln -sf /etc/apache2/sites-available/magentowebsite.com.conf /etc/apache2/sites-enabled/`

Solution 3

If your magento installation does not reside within your public folder, then issue the following commands from your magento root directory to ensure that all files are generated and symlinked within the public folder:

(The -f argument supplied with the setup:static-content:deploy command is required when operating in default or developer mode, but can be omitted in production mode.)

$ php bin/magento cache:flush
$ php bin/magento setup:upgrade
$ php bin/magento setup:di:compile
$ php bin/magento indexer:reindex
$ php bin/magento setup:static-content:deploy -f
$ ln -sf /var/www/magentowebsite.com/private_html/magentoroot/pub/* /var/www/magentowebsite.com/public_html/*

Restart your apache server once more and check whether the problem is solved.

Solution 4

Refer to the Magento documentation regarding file ownership and permissions and issue the commands relevant to your server configuration.

Solution 5

Read through the Magento DevDocs again and ensure that you have assigned all of the proper PHP settings. If you need to change anything, then ensure that you restart the server before trying to connect to the frontend.

If the problem persists after trying all of these solutions, please add further information about your server configuration (operating system, apache or nginx config files, php version etc.).


there no need any solutions or long checklists.

make sure that apache/php-fpm user/process has read access to yout web root folder.

this is a common mistake / error when you deploy files in cpanel and then change handler or user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.