Not Found The requested URL was not found on this server.

AWS By Aug 15, 2023 No Comments

Ubuntu Apache 2 – Not Found The requested URL was not found on this server.

Ubuntu Apache 2 on WordPress – Not Found The requested URL was not found on this server.

Explanation: Here are a few things to try to fix the “Not Found The requested URL was not found on this server” error in Apache on Ubuntu:

1. Check that the Apache service is running:

sudo systemctl status apache2

2. Make sure the required modules are enabled (like mod_rewrite):

sudo a2enmod rewrite

3. Check the Apache configuration files for errors:

sudo apache2ctl configtest

4. Make sure the directory/file you are accessing actually exists and has the right permissions.

5. If you are using WordPress add the following to .htaccess in public folder.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

6. Mod_rewrite Configuration.
If you are using mod_rewrite for URL rewriting, make sure it is enabled and configured correctly in your virtual host file.
Replace below code

<Directory /var/www/>
     Options Indexes FollowSymLinks
     AllowOverride None
     Require all granted
</Directory>

to

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

7. Check the Apache access and error logs for more details on the 404 error:

/var/log/apache2/

8. Restart Apache after any configuration changes:

sudo systemctl restart apache2

If the issue persists, enable debug logging and check those logs. Also try accessing the server locally to narrow down connectivity issues.

Let me know if you have any other specific details on the error – happy to help further troubleshoot!

Author

I'm Abhay Singh, an Architect with 9 Years of It experience. AWS Certified Solutions Architect.

No Comments

Leave a comment

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