<?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/"
	>

<channel>
	<title>Bytearray - Programming, Computers and Technology &#187; header redirect</title>
	<atom:link href="http://bytearray.brixtonjunkies.com/tag/header-redirect/feed/" rel="self" type="application/rss+xml" />
	<link>http://bytearray.brixtonjunkies.com</link>
	<description></description>
	<lastBuildDate>Tue, 03 Nov 2009 11:52:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress Adsense &#8211; Ad Targeting Redirect</title>
		<link>http://bytearray.brixtonjunkies.com/2009/08/20/wordpress-adsense-ad-targeting-redirect/</link>
		<comments>http://bytearray.brixtonjunkies.com/2009/08/20/wordpress-adsense-ad-targeting-redirect/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 16:16:47 +0000</pubDate>
		<dc:creator>alchemist</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[ad targeting]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[header redirect]]></category>
		<category><![CDATA[permalink]]></category>

		<guid isPermaLink="false">http://bytearray.brixtonjunkies.com/?p=60</guid>
		<description><![CDATA[When I was a Adsense n00b I made the mistake of adding adding a witty statement in my tagline in wordpress which confused adsense in terms of the content of my site, despite all the search engine optimization I had done . The symptom was: only the main index of my site had ads targeted [...]]]></description>
			<content:encoded><![CDATA[<p>When I was a Adsense n00b I made the mistake of adding adding a witty statement in my tagline in wordpress which confused adsense in terms of the content of my site, despite all the search engine optimization I had done . The symptom was: <span style="text-decoration: underline;">only</span> the main index of my site had ads targeted solely on the wordpress &#8220;tagline&#8221; <em>(the strip of text under the main title)</em>,  all other pages on my site were targeted correctly. I thought this would be a matter of simply changing the tagline&#8230;but no, google doesn&#8217;t forget! I wont go into detail about the type of ads that were being targeted, lets just say they weren&#8217;t ideal.</p>
<p>A simple effective work around is a header redirect <em>(permalink friendly)</em> on the main site index which can be prefixed to the wordpress index.php in your wordpress top level directory. </p>
<pre class="brush: php;">
&lt;?php

// set $redirectHome = false to disable the redirect

$redirectHome = true;
if ($redirectHome){
        // Redirects index page
        $uriStr = $_SERVER['REQUEST_URI'];
        if (($uriStr == '/') || ($uriStr == '')){
                header('Location: /?index',true,301);
                die();
        }
        // Makes sure pages off the main index are not renamed
        $matchAry = array();
        if (preg_match('/(\/page\/\d+\/)\?index/',$uriStr,$matchAry)){
                header('Location: ' . $matchAry[1],true,301);
                die();
        }
}

/**
 * Original Wordpress index.php goes here
 */
</pre>
<p>This works because Google thinks &#8220;/?index&#8221; is a new page <em>(it&#8217;s not though, it&#8217;s the main index with a query string attached)</em> and the media bot crawls it and targets it accordingly as a new page. And as long as you&#8217;ve made your amendments to your previously incorrect content, in my case the &#8220;tagline&#8221; then this time around your ads should be accurately targeted&#8230;hopefully <img src='http://bytearray.brixtonjunkies.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The curious thing is, it seems no matter what only my original main index is targeted incorrectly still months later. I&#8217;ve seen other posts relating to incorrect ad targeting on the main index only. It seems like Google&#8217;s media crawler doesn&#8217;t like something about Wordpress, I would like to hear from others that have experienced this.</p>
]]></content:encoded>
			<wfw:commentRss>http://bytearray.brixtonjunkies.com/2009/08/20/wordpress-adsense-ad-targeting-redirect/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
