WAMP Cannot access on local network 403 Forbidden

WAMP Cannot access on local network 403 Forbidden

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

The Hidden Default Configuration Behind WAMP 403 Errors

A classic frustration in local development environments occurs when your application runs perfectly on localhost but immediately returns a 403 Forbidden error when accessed via your machine's IP address, such as 192.168.x.x. This behavior often leads developers down a rabbit hole of firewall rules, router port forwarding, and antivirus exclusions. However, the issue is rarely external connectivity; it is almost always an internal server configuration mismatch.

The core problem stems from how Apache handles requests based on the RequestURI. When you access localhost, the URL is interpreted as http://localhost/. When you access your machine via IP, the URL becomes http://192.168.x.x/. While these point to the same physical server, Apache's default configuration treats them distinctly if virtual hosts are not explicitly defined for the root directory.

The Root Cause: Missing Virtual Host Definition

In a standard WAMP installation, particularly versions like 2.4 using Apache 2.4, the default httpd-vhosts.conf file (or its equivalent in newer installations) often lacks an entry that specifically maps the server's IP address to the root document directory (htdocs). Without this mapping, Apache attempts to serve content from a non-existent or restricted location for the IP-based request, triggering the 403 error.

This explains why one PC works out of the box while another requires configuration. If the default configuration includes a catch-all virtual host for localhost but omits explicit rules for <IP:Port>, the server will reject direct IP access unless you define it manually. The fact that IIS works perfectly on the same machine highlights this distinction: IIS often handles root requests differently by default, whereas Apache relies heavily on strict virtual host definitions in 2.4.x.

Implementing the Fix

To resolve this, you must explicitly tell Apache to serve your site when accessed via IP address. You need to edit your virtual host configuration file. In WAMP environments, this is typically located at wamp\www\apache\conf\extra\httpd-vhosts.conf.

You should add a new VirtualHost block that matches the specific IP and port you are using. Here is the correct syntax to add:

<VirtualHost *:1234>
    ServerName localhost
    DocumentRoot "C:/wamp/www"
    
    <Directory "C:/wamp/www">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

The critical element here is the Require all granted directive. In Apache 2.4, this replaced the older Order allow,deny and Allow from all syntax. If this line is missing or uses an older directive that conflicts with your security settings, Apache will deny access to requests not explicitly allowed by a virtual host context.

Additionally, ensure your httpd.conf file has Include extra/httpd-vhosts.conf enabled. This inclusion directive loads the virtual hosts defined above. If you are using WAMP 2.5 or later, the configuration structure may differ slightly, often moving to a sites-available and sites-enabled directory structure similar to Debian/Ubuntu Apache setups, but the principle of defining the root for the IP remains identical.

Why Firewall Rules Didn't Help

The user in the source material attempted to open ports on Windows Firewall and McAfee without success. This is a common misunderstanding. A 403 Forbidden error is an HTTP response code generated by the web server itself, not a network blockage. If you could reach the port (which you can verify using telnet or nc from another machine), but received a 403, the TCP connection succeeded, and the application layer rejected the request.

Furthermore, opening a port forward on your router is unnecessary for accessing your own machine over your local LAN. Routing rules are designed to map external public IPs to internal private IPs. When you connect from 192.168.x.y to 192.168.x.z, the traffic stays within the subnet; no port forwarding rule is triggered unless the router is performing NAT for external clients.

Verification and Testing

After adding the virtual host configuration, restart the WAMP stack. You can verify the fix by clearing your browser cache or opening an incognito window to ensure you aren't seeing a cached 403 page from before the change.

If the issue persists despite correct configuration, check your .htaccess files within the project directory. Ensure that no Deny from all rule is present in .htaccess files inside C:/wamp/www. Sometimes, legacy security scripts or strict .htaccess rules can override directory-level permissions, causing a 403 even when the virtual host is correctly defined.

By explicitly defining the virtual host for your IP address and ensuring Apache 2.4's Require all granted directive is active, you align the server behavior for local IPs with that of localhost, effectively resolving the access restriction without needing to alter firewall or router settings.

Our network