Is htaccess file still the best way to redirect .htm to .php version of the file?

I am ready to start a new version of an existing site that currently has all the .htm files and the new files will be exactly the same but with a .php extension - updates the htaccess file with

RedirectMatch 301 (.*)\.htm$ $1.php 

      

still the best way to redirect all these files?

I have never done this through an htaccess file, I read that this is an immediate change.

I found this answer on this site, but it has been from 2012, so I just want to be sure it's still the best solution.

+3


source to share


1 answer


Adding RedirectMatch 301 ^(.+?)\.htm$ $1.php

to your .htaccess file should be fine if you are using Apache.

However, if you are using nginx, for example, you cannot use .htaccess files.



(If you are using nginx, try reading here .)

0


source







All Articles