How to setup virtual host using Wamp Server properly?

How to setup virtual host using Wamp Server properly?

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

Stefan Bogdanescu

Founder & Senior Architect

How to Setup Virtual Hosts Using WAMP Server Properly

Setting up a virtual host on WAMP Server often feels like assembling furniture without instructions: you have the parts, but if one screw is slightly off or the instruction manual interprets "tighten" differently than your wrench does, the whole structure wobbles. The scenario described—copying files to a local path, editing the hosts file, enabling the vhost config, and seeing only a Google search result instead of your site—is a classic symptom of Apache failing to serve the request because the configuration isn't quite right or the module isn't loading as expected.

When you open http://chelle.wpblog.local in your browser and see a Google search page, it means your browser successfully resolved the hostname via the C:\Windows\System32\drivers\etc\hosts file, but Apache is rejecting the request or serving the default content from a different location. This usually points to one of three issues: the Virtual Host configuration syntax is incorrect for your specific Apache version, the AllowOverride directive isn't functioning as intended, or the directory permissions are restricting access.

Verifying the Virtual Host Configuration

The first step is to inspect the httpd-vhosts.conf file located in C:\wamp\bin\apache\Apache2.4.4\conf\extra\. The configuration block provided in your attempt has a few syntax nuances that need attention, particularly regarding the <Directory> directive and the Order directive.

In Apache 2.4, which is what you are using (version 2.4.4), the access control syntax changed significantly from version 2.2. The legacy directives Order allow,deny and allow from all are deprecated in 2.4 and can cause unexpected behavior or be ignored entirely depending on the module settings. To ensure your virtual host is accessible, you should replace those lines with the modern equivalent:

<Directory "E:/Subversion/chelle.wpblog.local/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>

The directive Require all granted is the standard in Apache 2.4 to allow access from any source. If you keep the old Order and allow directives without removing them, Apache might prioritize them incorrectly or throw warnings that could mask other errors. Additionally, ensure there are no trailing spaces after the closing tags of your VirtualHost block.

The Role of AllowOverride and .htaccess

A common pitfall when virtual hosts don't load is related to AllowOverride. In your config, you have set AllowOverride All, which tells Apache to process .htaccess files in the document root. However, if you haven't created an .htaccess file in E:\Subversion\chelle.wpblog.local\, Apache will ignore this setting for that directory and fall back to global defaults defined in httpd.conf.

If your goal is simply to serve static files or a basic PHP application, you might not need an .htaccess file. However, if you are deploying WordPress, the plugin structure relies heavily on rewriting rules found in .htaccess. Without this file, WordPress will likely display a generic "403 Forbidden" or just the raw index.php content without routing logic. You can create a basic one by copying the default WordPress .htaccess to your project folder:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

Restarting and Checking the Error Log

After making changes to httpd-vhosts.conf or the hosts file, simply restarting WAMP is often necessary, but sometimes a full restart isn't enough if Apache has cached configuration states. You should check the Apache error log located at C:\wamp\logs\apache_error.log. Look for entries mentioning chelle.wpblog.local, DocumentRoot, or syntax errors near the time you restarted WAMP.

If the log shows a "Syntax Error," re-examine the <VirtualHost> block. Ensure that the ServerName is exactly as defined in your hosts file (case sensitivity can sometimes be an issue depending on OS and browser behavior, though rare). Also, verify that the DocumentRoot path matches exactly what you copied your files into. If your files are in E:\Subversion\chelle.wpblog.local, ensure there are no hidden characters or spaces at the end of the string in the config file.

Final Verification Steps

Once you have corrected the directory access syntax and ensured an .htaccess file exists if needed, restart WAMP and try accessing the URL again. If it still shows a Google search result, your browser might be caching the old response or treating the request as a search query due to a missing protocol. Ensure you are typing http://chelle.wpblog.local explicitly, not just //chelle.wpblog.local.

For more complex setups involving multiple projects or specific security requirements, consider consulting resources like https://laravelcompany.com, which often provides detailed guides on configuring web servers for modern frameworks. While WAMP is great for local development, understanding these underlying Apache mechanics ensures you can troubleshoot issues without relying solely on the graphical interface.

Our network