3

I am ready to launch a new version of an existing site which currently has all .htm files and the new files will be exactly the same name but with a .php extension - is updating the htaccess file with:

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

still the best way to redirect all of these files?

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

I found this answer on this site but it was from 2012 so I just want to be sure it is still the best solution.

JJJ
  • 32,902
  • 20
  • 89
  • 102
Jen
  • 33
  • 2

1 Answers1

0

Adding RedirectMatch 301 ^(.+?)\.htm$ $1.php into your .htaccess file should be fine if you're running Apache.

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

(If you're using nginx, try taking a a read here.)

Daniel Dewhurst
  • 2,533
  • 2
  • 21
  • 39