- You need to edit main configuration files are usually located in the /etc/apache2 directory. This will typically be the 000-default.conf file for the default site or a specific virtual host
sudo nano /etc/apache2/sites-available/000-default.conf
for subdirectory rewrites, you need to focus on the subdirectory path. Add the AllowOverride All directive to enable .htaccess file overrides in that specific directory like /var/www/html/subdirectory/
AllowOverride All # Optional: Additional settings for the directory
Ensure that the .htaccess file has proper permissions so Apache can read it:
then restart apache server.