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 :)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!