Redirect HTML extension to PHP

It’s very easy to redirect requests to .html pages to .php pages. You will need to add some lines to the .htaccess file. If this file doesn’t exist in your directory then you must create it.

The two lines are:

RewriteEngine On
RewriteRule ^(.*).html$ /$1.php [L,R]

Now, HTML files will be redirected to php files. E.g. will be redirected to

Redirect *.html to *.php

To test .htaccess code you can use

Leave a Reply