“The requested URL was not found on the server” is one of the most common errors webmasters or website owners using the Apache webserver encounter. Commonly known as the 404 error, this error indicates that the site’s page cannot be accessed or opened by the visitor or a bot, and the bot/visitor has encountered an HTTP 404 error. Why is this error thrown, and how to fix it? Go through the following paragraphs to find out why users encounter this error and see the solutions to this problem.
Entered link is wrong
WordPress, the most popular content management system, can redirect incomplete URLs to the one that is matching it. For example, suppose the WordPress site’s original link is example.com/this-is-a-test-post/. The user accidentally enters example.com/this-is-a-test in the browser’s address bar and clicks the enter button. In this case, the CMS will automatically redirect this URL to link 1 with a proper HTTP status code. If the CMS you’re currently using doesn’t have such a function, you will encounter the 404 error, or the requested link was not found on this server error.
Redirects are not working
Another reason why a CMS may show the requested URL was not found on this server message is that the redirects are not working as per the user’s expectation. You can test the regex expression responsible for redirection with online regex tester tools you find on the internet or use a broken URL checker tool to learn whether the redirects are working or not. The regex tester tool shows two textfields – one to enter the regex expression and another to enter the test string (the string can be a link). When you fill both fields, the regex tester will show whether the string matches the regex pattern. Some of the tools may also explain why there was a mismatch. Which tools can you use? You can use Regex101 and RegexTester to test regular expressions.
The redirection checker tools prompt you to enter a URL. Once you enter the link, click the button displayed next to the textbox. The tool will now show the HTTP status code and the destination URL (if the URL is redirecting). If you don’t want to use the tool, you can use the browser to check if the link is redirecting correctly or not. To do so, open the browser developer tools, open the network tab, enter the link in the browser’s address bar and click the enter button. The browser will now show a list of links it has requested and their status code, size, type, etc.
Redirection module is not enabled
To ensure that the redirects are working on an Apache web server, you must enable the rewrite_module in the httpd config file. The server-side redirects will work only when you activate this module.
You’re not using a plugin
If you’re using the WordPress content management system, you can quickly fix the “the requested URL was not found on this server” issue by using one of these redirection plugins:
Redirection
In addition to redirecting the link, this plugin can monitor the changes to the permalinks of a WP site and record every 404 error the user encounters while accessing the pages of the site. This extension shows the number of times the broken link was accessed, and the last time a visitor or a bot accessed the link.
RankMath
The free edition of the RankMath search engine optimization plugin can redirect broken links to the URL of your choice. The redirection module is disabled by default. You can enable it with one click of a button from the plugin’s dashboard. When you enable the module, all you have to do is open the Redirection page of RankMath and click the “Add new” button, which you’ll find on the top left corner of the page. Now, enter the source/destination URLs, redirection type in the form, choose the “Activate button” option and click the “Add” button.
Safe Redirect manager
An excellent alternative to the above two extensions, this plugin can redirect one link to another with one of these 8 HTTP status codes – 301, 302, 303, 307, 403, 404, 410. It supports regex patterns.