Links in to pages that no longer exist

jeanm

Member
I've just started to modernize my three web sites. In doing so I will be changing each page from .htm to .php. It has just occurred to me that all the inbound links I've worked hard to get over the years are no longer going to work. By losing all these inbound links I presume my site will suffer. What does a person do in this situation please?

As I get each site functional in its new mode I'll have to get rid of all the old .htm pages. What is the best way to handle this please? I presume it will take ages for all those original pages to disappear out of the search engine. :confused:

Thanks in advance of the usual wonderful advice I get from this forum.
 

smoovo

New Member
I'm not sure but try to use .htaccess file. You can modify it that if someone will try page.htm or page.html it will change it to page.php. It's like redirect tool in this case.

This is redirect any html to php file.
PHP:
RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php

This redirect one page. use the same line for each page.
PHP:
Redirect 301 /oldpage.html http://www.example.com/newpage.html

Notice: Always check your pages if they are working or broken after modifying this file.
 

jeanm

Member
Thanks smoovo. So, do I create a .htaccess file and then plonk the given code in it and then it will work for all pages within that site? So I would use the first section of code and where your orange "example" part is I would write //www.railway-train-travel.com.au$1.php Is that the idea? Sorry if I'm a bit dense in the brain. :confused:
 

smoovo

New Member
Yes.

The first part - any file name with .html extension will redirect.
The second part - the location of the file to be directed to.

In this case you want any .html file to redirect to the same name but a different extension. The second part has to be a full path, since it is indicates where to go from here, and it is enable to go anywhere, even an outside domain name. The first part is only the term of recognizing that file not existent on this domain.

- Good Luck.
 
Top