Search code examples
.htaccess

redirect all .html extensions to .php


I want to update all the pages on a website to use include for the footer and header. So I have to change a lot of .html pages to .php.

So i'm looking for a way to redirect all pages that end with .html to the same url but ending in .php.


Solution

  • RewriteEngine On
    RewriteRule ^(.*)\.html$ $1.php [L]
    

    If you want it to be done as a redirect instead of just a rewrite modify the [L] to [L,R]