Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Feb 2011
    Your Monitor
    Thanked 559 Times in 546 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; 09-08-2011 at 02:17 AM.
    I can't really think of anything to write here now...

  2. #2
    New Coder
    Join Date
    Jul 2011
    Thanked 13 Times in 13 Posts
    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts