Web Analytics Made Easy -
StatCounter 500+ html pages.. converting to dynamic.. need to keep URLs. - CodingForum


No announcement yet.

500+ html pages.. converting to dynamic.. need to keep URLs.

  • Filter
  • Time
  • Show
Clear All
new posts

  • 500+ html pages.. converting to dynamic.. need to keep URLs.


    A friend of mine has asked for help to convert his site to a dynamic website. It has 500+ static html pages which he would like converted to PHP so that the site can run from one template, add/edit/delete articles quickly and generally be more efficient.

    The problem is that the site is listed highly in search engines for certain terms with the static URLs EG http://www.his-site.com/sites/site215.html. Obviously converting to a dynamic system will loose this and affect his search engine ranking considerably.

    I can convert the site to php with minimal fuss however we need to preserve these URLs. I have several ideas but I'm not clued up in this area so need some advice:

    1) Issue 302 errors for all of the urls pointing to the new urls article.php?id=215
    2) Mod rewrite? - I've no idea how to use it in this scenario.
    3) Leave all the html files there with redirects and meta tags.

    Any chance of some advice here? - This is a large professional site and while PHP/MySQL isn't a problem I can't let the guy down and need a rock solid solution.

    Many thanks,

    Last edited by tangoforce; Sep 7, 2011, 09:17 PM.
    "Tango says double quotes with a single ( ' ) quote in the middle"
    '$Name says single quotes with a double ( " ) quote in the middle'
    "Tango says double quotes ( \" ) must escape a double quote"
    '$Name single quotes ( \' ) must escape a single quote'

  • #2
    Yes, mod_rewrite is the answer. The site215 part is assumably somekind of unique identifier that you have added as a database field, if it's not, then it needs to be (if they are all site, you can obviously just keep the 215 part). Then you use something like this...

    RewriteCond %{REQUEST_URI} !-f
    RewriteRule ^sites/site([0-9]+)\.html$ /article.php?id=$1 [L]
    NB. Bare in mind you need to change any links on your page to be sites/site215.html, rather than article.php?id=215, this is not automatic.