PHP question

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
mpking
Regular
Posts: 13
Joined: Fri Oct 12, 2007 2:02 pm

PHP question

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PHP question

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
mpking
Regular
Posts: 13
Joined: Fri Oct 12, 2007 2:02 pm

Thanks!!

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Thanks!!

Post by garvinhicking »

Hi!

Good modifications, that indeed makes good sense.

Have fun using Serendipity!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply