View Single Post
Old 02-02-2014, 09:21 AM  
dunhill
Confirmed User
 
dunhill's Avatar
 
Industry Role:
Join Date: Jul 2013
Posts: 89
Quote:
Originally Posted by abshard View Post
Is there an easy way to implement a 301 redirect for thousands of pages? Seems impossible the way my site is setup using a random id tag for each page.

I'm trying to possibly move from nubilestube to mechbunny if that helps
You can change the video.php script to something like:
PHP Code:
$id = $_GET['id']; //obviously clean this shit to avoid SQLI
//SQL Query: SELECT permalink FROM videos WHERE id='$id' LIMIT 1;
//$new_link = Query result || throw 404 header if id not found and exit script

header('HTTP/1.1 301 Moved Permanently');
header('Location: /videos/'.$new_link.'.html');
//If Bing won't rely on headers:
?><!DOCTYPE html>
<html>
<head>
<link href='http://site.com/videos/<?php echo $new_link;?>.html' rel='canonical'/>
</head>
<body>
<a href='http://site.com/videos/<?php echo $new_link;?>.html'>Moved</a>
</body>
</html>
<?php
die();
Update the sitemaps and set canonical url on the new pages.
I have moved some websites in a similar way but better to keep the old url format even if you update the script.
The old links looks less spammy in my opinion.
dunhill is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote