Forum Moderators: phranque

Message Too Old, No Replies

Went from HTML to PHP, What is the right way to Redirct to new pages?

What is the right way to redirect old pages to new the new ones?

         

12scott34

4:49 pm on Jun 21, 2005 (gmt 0)

10+ Year Member



Hey everyone,

So we just launched a new site where all the pages are .php. We kept all the old .html pages up and now I'm worried about having two pages that are identicle on the web.

We currently are getting pretty decent amount of traffic to the old .html pages but nothing spectacular.

What is the best thing to do in this situation?

1. Should I just delete out the .html pages and let the search engines eventually just do away with the broken pages?

2. Should I redirct the .html pages to the new .php pages? If so, what is the best way to do this?

3. Is there any other recomendations that you can give me for a situation like this?

encyclo

5:16 pm on Jun 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The best way is not to change the file names at all - then you won't have any problems. If you are running Apache, you can have .html files parsed for PHP:

AddHandler application/x-httpd-php .php .html

It may well be too late for that, however. In that case you should use a 301 Permanent Redirect from the old pages to the new. If the file names are identical all apart from the file extension, you can do something like this:

DirectoryIndex index.php
RedirectMatch 301 ^/(.*)\.html$ http://www.example.com/$1.php

(I find that the DirectoryIndex rule can help smooth out certain bugs). Just append it to your root-level .htaccess file (or create one if you don't have one already). If your needs are more complex, then check out the forum library in the Apache web server [webmasterworld.com] forum where there are links to the appropriate resources and various sample redirects.

12scott34

5:36 pm on Jun 21, 2005 (gmt 0)

10+ Year Member



Thank you for the responce. I think it may be to late for the first option.

One more question, We have worked hard on a link campaign to drive links to our index page. Now that our index page is .php does that mean we loose all those links? Or does the re-direct point the PR and value of those links to the new .php page?

Thanks again for your help!

encyclo

5:39 pm on Jun 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your inbound links are pointing to
http://www.example.com/
then there will be no difference. If they are pointing to
http://www.example.com/index.html
then you will need to redirect index.html to the root (without file name) version.