Page 1 of 1
PHP question
Posted: Sun Oct 14, 2007 4:33 am
by mpking
So I just switched to serendipity from an different PHP project.
I need to redirect the old pages to the new serendipity pages. The old pages
were of the format of:
http://www.mpking.com/articles.php?lng=en&pg=55
The new page is..
http://www.mpking.com/index.php?/archiv ... ctory.html
Idea's?
Re: PHP question
Posted: Sun Oct 14, 2007 1:21 pm
by garvinhicking
Hi!
You would need to add one "old" location and one new location manually, since there is no automatism for your redirect.
I would suggest to create a articles.php with a content like:
Code: Select all
<?php
switch($_REQUEST['pg']) {
case '55': header('Location: http://www.mpking.com/index.php?/archives/8-FreeRADIUS-PEAP-against-Active-Directory.html');
break;
case '54': header('Location: http://www.mpking.com/index.php?/archives/7-title.html');
break;
case '53': header('Location: http://www.mpking.com/index.php?/archives/6-title.html');
break;
}
... and so forth?
Regards,
Garvin
Thanks!!
Posted: Sun Oct 14, 2007 3:32 pm
by mpking
Thanks Garvin!
That did the trick, or it was enough to get me rolling.
I added a moved 301 header to it, so it's google friendly, and I added a default case statement since I had a few pages that I didn't repost.
Here's the final form of what I went with:
Code: Select all
<?php
header("HTTP/1.1 301");
switch($_REQUEST['pg']) {
case '55': header('Location: http://www.mpking.com/index.php?/archives/8-FreeRADIUS-PEAP-against-Active-Directory.html');
break;
case '41': header('Location: http://www.mpking.com/index.php?/archives/2-Finding-Stale-Mailboxes-in-Meridian-Mail.html');
break;
case '65': header('Location: http://www.mpking.com/index.php?/archives/3-Yankee-Swap-Rules.html' );
break;
case '40': header('Location: http://www.mpking.com/index.php?/archives/4-Print-Info-from-Meridian-Mail.html' );
break;
case '24': header('Location: http://www.mpking.com/index.php?/archives/5-Color-LS.html' );
break;
default:
header('Location: http://www.mpking.com/' );
}
?>
Thanks again.
Re: Thanks!!
Posted: Sun Oct 14, 2007 3:56 pm
by garvinhicking
Hi!
Good modifications, that indeed makes good sense.
Have fun using Serendipity!
Regards,
Garvin