<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Anthology of Ideas &#187; permalinks</title>
	<atom:link href="http://anthologyoi.com/tag/permalinks/feed" rel="self" type="application/rss+xml" />
	<link>http://anthologyoi.com</link>
	<description>Anthology of Ideas is an archive of thoughts and form.</description>
	<lastBuildDate>Sat, 03 Mar 2012 11:16:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Redirecting a large number of posts to their new WordPress permalinks.</title>
		<link>http://anthologyoi.com/wordpress/redirecting-a-large-number-of-posts-to-their-new-wordpress-permalinks.html</link>
		<comments>http://anthologyoi.com/wordpress/redirecting-a-large-number-of-posts-to-their-new-wordpress-permalinks.html#comments</comments>
		<pubDate>Thu, 25 Jan 2007 14:45:50 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[301 redirect]]></category>
		<category><![CDATA[permalinks]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://localhost/aoiv2/blogroll/redirecting-a-large-number-of-posts-to-their-new-wordpress-permalinks.html</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Add this to the VERY top of your theme&#8217;s 404 page.<br />
Change http://localhost/wordpress to your default wordpress folder.<br />
This just does posts and possibly pages that end in the id (with or without the trailing url) Categories etc will have to be done elsewhere or by hand.<br />
<pre class="brush: php">&lt; ?php
//Kinda obvious
$rf = $_SERVER[&#039;REQUEST_URI&#039;];
$rf = explode(&#039;/&#039;,$rf);
$last = count($rf);

//Filter out regular 404 that arn&#039;t old urls
if(is_numeric($rf[$last-1])){
	$post_id = $rf[$last-1];
}elseif(is_numeric($rf[$last-2])){
	$post_id = $rf[$last-2];
}

// No sense loading WP if there isn&#039;t an id
if ( $post_id ) {
	// Oh fine we will load wordpress
	define(&#039;WP_USE_THEMES&#039;, false);
	require(&#039;http://localhost/wordpress/wp-blog-header.php&#039;);
		$post = get_post($post_id);
	//Well hope it is the right post. If not, ohwell. We tried.
	if($post){
		//Lets get the new URL
		$new_link = get_permalink($post_id);
		//We don&#039;t want google to get angry with us.
		header(&quot;HTTP/1.1 301 Moved Permanently&quot;);
		header(&quot;Location: $new_link&quot;);
	}
}
?&gt;</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://anthologyoi.com/wordpress/redirecting-a-large-number-of-posts-to-their-new-wordpress-permalinks.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

