I’ve followed the How To Set Up Mod_Rewrite guide.
sudo a2enmod rewriteto test it’s been enabled. Terminal outputs: Module rewrite already enabled
The guide says,
To allow the .htaccess file to override standard website configs, start by opening up the configuration file.
I ran this command
sudo nano /etc/apache2/sites-available/default and the file was empty
So I copied and pasted the example
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
sudo service apache2 restart to restart the apache server.
I’m using a
.htaccess file I’ve used for other websites, so unless there’s anything specific I need to include for Digital Ocean, it should work…
.htaccess is inside the
html folder located at
I’ve cleared the cache, restarted the browser and the
mod_rewrite isn’t working?
I then noticed the example code above was pointing at
/var/www/ so I changed it to
<Directory /var/www/html> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
Cleared the cache, restarted the browser and the
mod_rewrite still isn’t working?
I’m very impressed with the speed of Digital Ocean Hosting! Would like to get this fixed :)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!