XAMPP Access Forbidden

14,895

Solution 1

I have experienced this problem and found out that localhost link is not configured in httpd_vhosts.conf. So I added this line at the bottom part of httpd_vhosts.conf

<VirtualHost *:80>
    DocumentRoot "E:/xampp/htdocs"
    ServerName localhost
</VirtualHost>

Solution 2

Well, probably this must be happening because the localhost link is not configured in your xamp vhost, try to look for the vhosts configuration file and add the same one there. Just add this block of code making the appropriate path changes until your repository so that you can access the localhost:

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "C:\ecommerce"
    ServerName www.hcodecommerce.com.br
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
<Directory "C:\ecommerce">
        Require all granted

        RewriteEngine On

        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [QSA,L]
	</Directory>
</VirtualHost>

Share:
14,895
Zac Cotterell
Author by

Zac Cotterell

Updated on July 01, 2022

Comments

  • Zac Cotterell
    Zac Cotterell almost 2 years

    I have just downloaded the latest version of XAMPP with PHP version 7.2.4. I have made a very simple PHP validation for a HTML form and when I press submit it comes up with the following:

    Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server.

    If you think this is a server error, please contact the webmaster.

    Error 403 localhost Apache/2.4.33 (Win32) OpenSSL/1.1.0g PHP/7.2.4

    I'd don't know what the problem is as I have tried changing Require none to Require all granted.

    Please Help!