I cant get rid of file extensions. What am I doing wrong?

So I have a .htaccess file and what I had put in it is not working. This is what I put:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php [L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule (.*) $1.html [L]

Im trying to get rid of file extensions. Ive tried similar variations of that and it hasnt worked. Am I doing something wrong?


Solved: Went to Apache Config file and set AllowOverride to All. Ubuntu 18.04 Commands: 1:

sudo nano /etc/apache2/apache2.conf


ctrl w

Then searched “AllowOverride” 3: The last directory was where my index and .htaccess was so then I changed it from “none” to “all” 4:

ctrl o then ctrl x

Submit an 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.