Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-08-2011, 02:08 AM   PM User | #1
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,500
Thanks: 44
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
500+ html pages.. converting to dynamic.. need to keep URLs.

Hi

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,

Tango
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.

Last edited by tangoforce; 09-08-2011 at 02:17 AM..
tangoforce is offline   Reply With Quote
Old 09-08-2011, 07:29 AM   PM User | #2
Cags
New Coder

 
Join Date: Jul 2011
Posts: 67
Thanks: 0
Thanked 13 Times in 13 Posts
Cags is an unknown quantity at this point
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...

Code:
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.
Cags is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:03 AM.


Advertisement
Log in to turn off these ads.