Why HTTP Error 404 Not Found issue occurs in XAMPP?
When you first installed XAMPP and activate the virtual host Apache, it will automatically forward it to the default port, usually port 80.
As you know XAMPP is a platform that uses the local resource as a base to develop any host-based application, the typical use is WordPress.
Whether you are a newbie or a vet in web and database development, you may come across a common issue with Apache localhost once you try to install Internet Information Services (IIS) among the most popular local web server XAMPP.
Once you enable IIS on your machine to learn a new CMS platform or develop apps or whatever you are trying to, you may get terrify when getting back to Apache and the browser throw you an error.
Base on my own experience, IIS is a sub-feature of Windows and can only be used when it is activated manually. If you would like to learn more about IIS, follow the guide Install IIS to host Sitefinity which will give you more insight about how to practice IIS in real life.
Since XAMPP is a third-party plugin or any similar application, its default port will be taken place by IIS. In other words, Microsoft Windows will take your default port back.
Fortunately, it is possible to generate another port to work separately. In fact, you can tell IIS to go somewhere else to play and you can keep your XAMPP playground untouched but this might be more complicated than moving the XAMPP port itself.
In this scroll, I will show you how to change XAMPP local port instead. There is a reason that you want to prevent making scratches on IIS system files due to its massive network optimized for local use already.
Fix 404 error from XAMPP after IIS setup
This is how your XAMPP Control Panel looks like after the IIS installation, the message indicates the port it was using is now lost:
Error: Apache shutdown unexpectedly. This may be due to a blocked port, missing dependencies, improper privileges, a crash, or a shutdown by another method. Press the Logs button to view error logs and check the Windows Event Viewer for more clues. If you need more help, copy and post this entire log window on the forums.
To fix this, look at the Apache section, click on Config and select Apache (httpd.conf). You will be taken to a Notepad window with its full configurations.
Press Ctrl-F and search for the line Listen 80.
Alter the number 80 to any number for example 1912 then a new line will look like this Listen 1912.
By doing this, you now successfully forced Apache to work on another port.
NOTE: Port number is dynamic, you can put your port number at your own choice, best practice is keeping it short and distinguishable.
Next, in the same file, look for another string ServerName localhost:80 and again, replace the 80 with the same port number as you determined earlier. They both must be the same.
After that, the new string will become Servername localhost:1912
By this step, you now assign a new DNS for your XAMPP Apache.
Restart the XAMPP Control Panel and reconnect again you will now see a new port associated with it.
With new port assigned, you have to include a suffix to your localhost since solely localhost has now been served to IIS only.
Your new link always contains 2 parts: localhost + NewPortSuffix. In this case localhost:1912/
- If you are not sure what you are doing, back up your file before modifying it.
- You are fixing the 404 error for Apache only, the remaining features of XAMPP are still not reconfigured. Hence apply the same procedure for the rest for your own needs.
The issue is likely to occur for every application like XAMPP, no matter what app you are dealing with even MAMP, WAMP, AMPPS,… The default port 80 will be taken as soon as you activated the IIS.
The fix is simple, yet crucial for every developer because we don’t usually work with only one local server but more than one. I hope this helps you out and go get your projects back to the track.
If you have any simpler solution please share it with us or any similar issue or the solution that I gave was not reasonable do not hesitate to post your idea.