I installed LAMP on my droplet and then I followed this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite and I used the contents for the file from my old web hosting, so I know it works: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA]
However, if I enter for example http://cyan.red/index it comes up with: Not Found
The requested URL /index was not found on this server.
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.
By default the LAMP install will disable usage of the
.htaccess
file.You need to edit the configuration file for your virtual host.
Change the
<VirtualHost>
directive to look something like this. The important part isAllowOverride All
, as this tells Apache that the directory can override default settings using a.htaccess
file.Now make sure the website is enabled.
Also make sure that the rewrite mod is enabled.
Now restart Apache
In my case, I was still hitting my head against the wall even after adding
AllowOverride all
to<VirtualHost *:443>
conf.I discovered you’ll need to remove
AllowOverride all
from your<VirtualHost *:80>
conf if it’s been specified there.None of this worked for me. What did work was to enable “AllowOverride all” in the apache2.conf file in /etc/apache2. For me it was on line 172 of that file. I tried everything else to eliminate my pages from giving a 404 when visiting pages but the homepage.