Forum Moderators: phranque
I want to change my dynamic php site to static html site to improve ranking and pages interlinking, however I have few concerns regarding:
- my current pages have domain.com/item.htm?id=1222 extensions, the new html will not be the same
- after I'm finished with the new html design should I delete all old files from the server and upload new site? Wouldn't I loose my ranking?
Thanks,
Tom
I use mod_rewrite to avoid any query string, but I do it when building the site. If you switch it up now you could be in for some trouble for awhile, until the engines get it figured out.
after I'm finished with the new html design should I delete all old files from the server and upload new site
That depends. Somehow, you need to send a 301(moved permanently) redirect to tell the engines(and humans!) that the file is elsewhere, permanently. You can do this with the PHP script(item.htm) or you can do it with .htaccess.
If it were me, I would keep the site dynamic(since it's so nice) structure, but make it appear static.
You could start naming you pages:
domain.com/item_1222.htm
Then, you can use mod_rewrite to send it to a script with the id appended but the user or bot don't see the new URL.
Example:
RewriteEngine On
#below rewrites the static URL to 'dynamic' and sends it to the proper script
RewriteRule ^item_(.*)\.htm$ /your_new_script.php?id=$1 [L]
#this one will catch the old style URLs and send 301
RewriteCond{REQUEST_URI} ^item.htm
RewriteCond{QUERY_STRING} ^id=(.*)
RewriteRule ^item_(.*)\.htm$ /your_new_script.php?id=%1 [L, R=301]
That's how I would approach it. The code may not be perfect, as will probably be pointed out later in this thread:) but it's a basic guideline.
Finally, like I said early in this long-winded post, I wouldn't even worry about one param like you have but here's an alternative. There are other methods as well.
Cheers,
Birdman