Topic: Switching from ASP to PHP... (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: USA |
![]() I run a semi-popular (6,000+ uniques/day) blog that I've had up for almost seven years now, and I've done a number of redesigns. I've been using ASP since the site was started, but almost all of my work now is done in PHP and C#.NET. |
Maniac (V) Mad Scientist with Finglongers From: Germany |
![]() well... when we switched this forum over to a completly different one, we used a combination of .htaccess and php-find-what-content-the-user-was-looking-for-in-a-big-array scripts that reported the correct 302: Document moved permamently (or was it 301? Look it up) response header. |
Bipolar (III) Inmate From: USA |
![]() Any chance you could post an example of the "php-find-what-content-the-user-was-looking-for-in-a-big-array" and the changes to your .htaccess file? I'd be forever grateful. |
Maniac (V) Mad Scientist with Finglongers From: Germany |
![]() well... the relevant part of the .htaccess reads like this code: RewriteEngine On RewriteRule ^(/Forum)([0-9]+)(/HTML/)([0-9]+)(.html) /lookup/asylumforum.php?forum=$1&thread=$2 [L] RewriteRule ^(/Archives/Archive-)([0-9]+)(/HTML/)(.+) /lookup/asylumarchive.php?archive=$2&thread=$4 [L]
code: <?php function notFound() { header("Location: /search"); echo "404 - Not Found - you'll be redirected shortly"; // NN4 requires that we output something... die(); } if (!(is_numeric(@$_GET['archive']) && isset($_GET["thread"]))) notFound(); $strFilename = dirname(__FILE__) . '/archive.'. $_GET['archive']. '.dat'; if (file_exists($strFilename)) { if ($fh = fopen($strFilename,'rb')) { $t = fread($fh,filesize($strFilename)); fclose($fh); $threads = unserialize($t); $threadName = $_GET["thread"]. '.cgi'; if (!isset($threads[$threadName])) notFound(); else { header("HTTP/1.1 301 Moved Permanently"); header("Location: /{$threads[$threadName]}"); header("Connection: close"); die(); } } else notFound(); } notFound(); ?>
|