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

Posted April 2, 2021 302 views

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?

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

    sudo nano /etc/apache2/apache2.conf


    ctrl w

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

    ctrl o then ctrl x

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.

Submit an Answer
1 answer
ARCHIVED: We have created a one-click Wordpress installation with permalinks enabled that uses Apache/MySQL/PHP on Ubuntu 16.04 x64.