I've read some of the other similar questions/answers here on doctype regarding best redirect practices. My unique situation remains unanswered.

Doing a site redesign and creating pages as php. Original pages were shtml. Is there specific coding required for this redirect using .htaccess?

One more thing. Client wants the site completed in phases, meaning some pages remain shtml while others will be php until the final phase of the project is completed. What's the best approach using .htaccess?

Thanks in advance!

1 answer


As far as I know there is nothing special about redirecting .shtml pages. If you use htaccess to redirect a .shtml file then that file just won't be parsed by the server.

If you are converting the site page by page you could do individual redirects for each page like so:

Redirect 301 /oldpage.shtml http://www.website.com/newpage.php

Once the site is completed you could use something like this:

RedirectMatch 301 (.*).shtml$ http://www.example.com$1.php

That would send any pagename.shtml to pagename.php, assuming that there are no matched rules before that line.

Answered over 8 years ago by Chris Markle
  • Thanks Chris. This is my first time redirecting with htaccess, so your input is much appreciated. Dave E over 8 years ago
  • Glad to help! Chris Markle over 8 years ago