How to Fix the XAMPP HTTP Error 404 (Step by Step)

XAMPP is a free and popular cross-platform local server solution. XAMPP is also a great choice for running WordPress on localhost. This application allows you to run multiple WordPress sites on your localhost and also manage your database with phpMyAdmin. However, there are some errors that many users face while using XAMPP. The XAMPP HTTP Error 404 is one such error.

The XAMPP HTTP Error 404 is usually seen when the requested resource from the client is not found by the server. As much irritating as this error is, there are ways of fixing it. You might see this error if you’re visiting a link that doesn’t exist. But sometimes, when you’re trying to log-in to your WordPress dashboard, you might see this error too. This is where the XAMPP HTTP Error 404 becomes the most annoying.

In this post, we’re going to discuss 4 methods through that you can hopefully fix the XAMPP HTTP Error 404. We found these steps to be the most common ways of fixing this issue. It is also important to discuss what this error is in detail. So first we will discuss this error, find out what could cause it, and then we will look at the solutions.

What does the XAMPP HTTP Error 404 mean?

XAMPP HTTP Error 404 is an http status code. This type of status code is sent from the server side to the client side. The error states “The requested URL was not found on this server”. You might also see the error message saying “Requested resource not found”.

error 404

In this case, basically the server cannot find the URL or resource that we requested. That much is clear. So we can conclude that the following reasons might be the cause of this error:

  • Spelling mistake in the URL
  • The domain doesn’t exist anymore
  • The requested resource might have been deleted or moved to another URL

Sometimes we mistype or misspell the URL on the browser. As you can expect, this will then result in the server trying to look for something that doesn’t exist. It will show this error. So before you try a comparatively more complex method, see if you’ve typed in the URL correctly!

How to fix the XAMPP HTTP Error 404

Running WordPress on localhost using XAMPP is quick and simple. But this error can show up on localhost as well as live servers. Now that you know what error 404 means, it’s now time to try fixing it. Here are 4 methods you can try to solve your XAMPP HTTP error 404.

Get Latest Post Notifications!

Subscribe to our newsletter

1. Change the Apache Port

If you’re having trouble opening a PHP file, then you might have an issue with your Apache configuration. There could be a conflict with the port that Apache is trying to use. By default, Apache uses port 80, but you might have to change the port if you have some other program using that port.

To find a free port, open up the XAMPP control panel and click on the Netstat button in the right column. Then look for httpd.exe on port 80 (default port used by Apache).

apache port in xampp

If port 80 is already in use, or if you would like to leave it open, you can then choose another port for Apache. You can use other ports such as 8000, 8001, 8080, etc. Just choose a free port for Apache to listen to.

To edit the port number, close the Netstat and open the httpd.conf file located in xampp > apache > conf. If you’re on Windows it should look like the following:

httpd.conf file in xampp

If you’re using macOS, then the file should be in /etc/apache2 directory.

Once you’ve located the file, open it in your text editor and edit two of the following lines:

Listen 80

ServerName localhost:80

Here, you can replace the ‘80’ with ‘8000’ or ‘8080’ or any free port you want. After you’re done, save and then close the file.

After that, you can then stop your Apache and MySQL services and then restart the XAMPP control panel. Then start your Apache and MySQL services. (Or simply quit XAMPP and run again!) Now your Apache will be running on the new port you’ve assigned to it. Now try to access your WordPress site again and see if the error is fixed. If the error still exists, then you might want to edit the http-ssl.conf file. You can find this file on xampp > apache > conf > extra on Windows.

opening httpd-ssl conf file

If you’re on macOS, you can find it on /etc/apache2

After you’ve located the file, open it in your preferred text editor. Now you need to update 3 lines in this file:

Listen 443
<VirtualHost _default_:443>
ServerName localhost:443

Note that these lines will be in different locations in the file. You will have to scroll and find these lines. You can also use “CTRL+F” if you’re on Windows and type each of the lines in order to find those. After you’ve found those lines, change the ‘443’ values to ‘8000’ or the new port you’re using for Apache.

Now you should be able to access localhost on the new port that you’ve assigned. This should also solve your error 404 “Requested resource is not found”.

XAMPP Apache port in URL

If you face this error even after changing your Apache port, you might need to replace your .htaccess file. So move on to the next solution to do that.

👉 Learn More: How to Fix Error Establishing Database Connection in WordPress

2. Replace the .htaccess file

The .htaccess file is usually found in the directory where your WordPress files are stored. WordPress uses this file to control how Apache serves files from its root directory and subdirectories thereof.

WordPress sites usually have a .htaccess file which, if missing, might cause the error 404. We’ve seen that, this file can be auto-created but if somehow it got deleted or moved, then you might face the error 404. To generate this file, log in to your WordPress dashboard and go to Settings > Permalink. From here select your preferred WordPress permalink settings or structure.

WordPress permalink settings

After you’re done, click on the ‘Save Changes’ button. This will automatically generate the .htaccess file. The file is located in the folder where you’ve kept your WordPress files.

accessing .htaccess file

In the screenshot above, we’ve installed our XAMPP on the G drive. To navigate to the .htaccess file we have to go to G:\xampp\htdocs\wordpress2

The above auto-generation method for .htaccess may not work for you. In that case, you can use the below-mentioned manual method.

Based on the server, every WordPress site you create may have a .htaccess file. For an Apache server, if you can’t find the .htaccess file in that location, then you have to create one. To do that, open your text editor and name the file “.htaccess” and then save it on the location of your WordPress files (see screenshot above to understand the exact location). Then paste in the following code:

# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

We have taken this code from wordpress.org documentation. You can read the documentation of .htaccess to better understand. Here’s a screenshot of the file so that you can see how the code looks after you paste the code:

So after you’re done, save the file and name it as “.htaccess”. Now you have a fresh copy of your .htaccess file. Try to log in to your WordPress again and see if you face the XAMPP HTTP Error 404.

👉 Learn More: How to Fix WordPress Error 500 (Complete Tutorial)

3. Deactivate and uninstall new plugins

Sometimes when you install new plugins, it makes certain changes to your site and your WordPress database. This change might cause the error 404. For starters, you can deactivate the plugins that you installed recently or uninstall them completely and check if the error persists.

WordPress plugins can be deactivated from the admin dashboard. From the dashboard go to Plugins > Installed Plugins. Then hover your mouse over a plugin and click on deactivate link under the name of the plugin to deactivate the plugin.

deactivating a plugin in wordpress

If you want to completely remove the plugin you can do it from the same screen. After deactivating the plugin, you will see the ‘Delete’ link below the name of the deactivated plugin. Click on it to uninstall the plugin.

deleting a plugin in wordpress

You can try out this method even if you haven’t installed any plugins recently. Since updating some plugins sometimes cause issues on WordPress, this method is worth trying out. 

If you can’t access your WordPress admin dashboard, you can deactivate all your plugins by renaming the plugins folder in your WordPress site’s directory. To find the plugins folder go to the drive where you’ve installed XAMPP and go to xampp/htdocs/wordpress/wp-content/plugins (for example).

Just rename the “plugins” folder to something else other than plugins and save it. Then try once again and see if the error 404 is solved or not.

4. Check your database for changes

After you’ve disabled or removed the plugins if you still see the error unsolved, then the changes made to your site still might persist. If you suspect this is the case, then it’s best to check your localhost’s database for changes.

To check your localhost database, open up your browser and visit “localhost/phpmyadmin”. Alternatively, you can open your XAMPP control panel and click on the Admin button next to MySQL to open phpMyAdmin.

opening phpmyadmin from xampp

After you open phpMyAdmin, click on the ‘Databases’ tab located at the top of the screen to open up the databases. Then select your site’s database in the list to view the tables within.

tables of a database in phpmyadmin

Now check the tables and try to identify anything unusual. Some plugins add entirely new tables to your database. To remove such a table, click on the ‘Drop’ link under Actions. Most of the plugins will make changes to the wp_options table, so you might want to check that out first. You can also take a look at the core WordPress tables but these tables aren’t normally changed.

If you’re not sure what your typical WordPress database and tables should look like, then it might be a good idea to create a fresh WordPress site. Then compare the databases of the two sites.

👉 Learn More: How to Use WordPress Recovery Mode – Complete Guide

👉 Also Read: How to Solve XAMPP Error: MySQL Shutdown Unexpectedly

Conclusion

The XAMPP HTTP Error 404 is indeed an annoying issue that many WordPress developers face while working. XAMPP is a truly amazing software if you wanna work on server-side projects. In fact, it is used by many industry professionals for testing and debugging. But through all those testing and debugging, sometimes you might face strange errors.

Solving errors is a part of web development. The XAMPP HTTP Error 404 is just one of the many errors that you might face in the world of development. So whenever you face any error, don’t panic, use this opportunity to learn more about your work. 

Every problem has a solution. Therefore, we do hope that you managed to solve the XAMPP HTTP error 404. Keep on learning and if you have any questions regarding this error or any other error, let us know in the comments.


Disclaimer: This post may contain affiliate links and we may receive a small commission if you purchase something by following them. However, we recommend services/products that we believe good to serve your purpose.

Staff Author
Staff Author

A team of WordPress enthusiasts led by Arafat Bin Sultan, a seasoned professional with over a decade of experience in tech blogging, content marketing, and video creation.

Articles: 236

Leave a Reply

Your email address will not be published. Required fields are marked *