Skip to main content

htaccess file extensions

Comments

3 comments

  • cPRex Jurassic Moderator
    Hey there, I had good luck with this block of code inside an existing Wordpress site: #Redirect /filename.php to /file RewriteCond %{THE_REQUEST} \s/([^.]+)\.php [NC] RewriteRule ^ /%1 [NE,L,R] #Internally map /filename to /filename.php RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)/?$ /$1.php [L]
    Can you try that?
    0
  • Abs Zaa
    Thank you but your code is for php. I am looking for .html. The following code works on Chrome for me, but not on Safari or Firefox. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html [NC,L]
    0
  • cPRex Jurassic Moderator
    I also confirmed that isn't working for me in Firefox when I tested just now. I don't have any additional code snippets to provide, although I am surprised that modifying the PHP version I provided also doesn't seem to work for html files. Perhaps another community member will add some of their thoughts here to help.
    0

Please sign in to leave a comment.