重装电脑后WAMP访问项目出现ERR_NAME_NOT_RESOLVED问题求助
Hey there, let's work through this ERR_NAME_NOT_RESOLVED issue you're hitting with your WAMP 3.1.3 setup. Since localhost loads fine but your specific project isn't resolving, this is almost always tied to virtual host configuration or local DNS mapping. Let's go step by step to fix it:
WAMP relies on Apache's virtual hosts to link your project folder to a custom domain. Let's verify this first:
- Open the WAMP manager, hover over Apache and select httpd-vhosts.conf to edit the file.
- Make sure your project has a properly formatted virtual host entry. It should look something like this:
<VirtualHost *:80> ServerName yourproject.local ServerAlias www.yourproject.local DocumentRoot "C:/wamp64/www/yourprojectfolder" <Directory "C:/wamp64/www/yourprojectfolder/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require local </Directory> </VirtualHost>- Swap out
yourproject.localwith the exact domain you're trying to access, andC:/wamp64/www/yourprojectfolderwith the real path to your project files.
- Swap out
- Also, head to Apache > httpd.conf and ensure the line
Include conf/extra/httpd-vhosts.confisn't commented out (remove the#at the start if it's there) — this enables Apache to use your virtual host settings.
Your computer's hosts file tells it to map custom domains to your local IP. Here's how to edit it:
- Open Notepad as Administrator (right-click the Notepad icon and select "Run as administrator").
- Navigate to and open the file at
C:\Windows\System32\drivers\etc\hosts. - Add these lines at the bottom, replacing the domain with your project's:
127.0.0.1 yourproject.local 127.0.0.1 www.yourproject.local - Save the file (you may need to confirm admin permissions when saving).
Any changes to config files won't take effect until you restart Apache:
- Left-click the WAMP icon in your system tray, go to Apache > Restart Service.
- Wait a few seconds for the service to restart, then try accessing your project domain again.
If you're using a port other than 80 (like 8080), you need to align it across your config and browser URL:
- In
httpd-vhosts.conf, change<VirtualHost *:80>to<VirtualHost *:yourportnumber>(e.g.,<VirtualHost *:8080>). - Your hosts file still points to 127.0.0.1, but when accessing the project, use
yourproject.local:yourportnumberin the browser. - You can check for port conflicts via WAMP's manager: go to Tools > Port Usage to see if another program (like IIS, Skype, or another web server) is using your target port.
Old cached data can sometimes block the domain resolution:
- Clear your browser's cache and cookies (use Ctrl+Shift+Delete on most browsers to open the clearing menu).
- Open Command Prompt as Administrator and run
ipconfig /flushdnsto clear your local DNS cache.
If none of these steps work, double-check that your project folder path in the virtual host config is 100% correct. If you stored your project outside the default www folder, you might need to change Require local to Require all granted in the <Directory> block to give Apache access to those files.
内容的提问来源于stack exchange,提问作者Syphex

