Solved: Requested URL Was Not Found on this Server Apache 2 Ubuntu

The requested url was not found on this server. ubuntu apache2; Through this tutorial, i am going to show you how to solve the requested url was not found on this server. ubuntu apache2.

How to enable rewrite module in apache ubuntu 18.04/20.04/22.04

Let’s use the following steps to solve the requested url was not found on this server. ubuntu apache2:

  • Step 1 – Update dependencies
  • Step 2 – Enable mod_rewrite Apache By a2enmod Command
  • Step 3 – Allow .htaccess File for VirtualHost
  • Step 4 – Restart Apache 2

Step 1 – Update dependencies

Run the following command to update apache 2 web server:

sudo apt-get update

Step 2 – Enable mod_rewrite Apache By a2enmod Command

Run the following command on terminal to enable mod_rewrite apache in ubuntu. So, you can connect your instance or web server to ssh terminal. And then type a2enmod command to enable any modules in Apache 2 web server:

sudo a2enmod rewrite

Step 3 – Allow .htaccess File for VirtualHost

After successfully enable the Apache 2 rewrite module. Then you need to add this “AllowOverride All” in your VirtualHost configuration file.

Note that – The main reason is to enable or allow .htaccess file in the Apache server. Because it does not allow by default. So, you can not use of ‘.htaccess’ file.

So, open your terminal and type the following command:

sudo nano /etc/apache2/sites-available/000-default.conf

Then you need to add this “AllowOverride All” in your VirtualHost configuration file like below:

<VirtualHost *:80>
    ServerName  www.example.com
    DocumentRoot /var/www/html
 
<Directory /var/www/html>
 Options Indexes FollowSymLinks
 AllowOverride All
</Directory>
 
</VirtualHost

Step 4 – Restart Apache 2

Finally, runt the following command on terminal to restart Apache 2 server to restart all configuration to the running environment.

sudo systemctl restart apache2

More Linux Ubuntu Tutorials

Be First to Comment

Leave a Reply

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