Dealing With Google Sitemap

When I use Webmaster Tools from Google, it requires sitemap of my site. There are several formats allowed, easiest one is RSS 2.0 format. I already have it as my blog feeds.

Then I realize that it need to be in the root directory, while my blog have the XML file within “feeds/” directory. Changing my code will be a pain, so I decided to do some trick.

I simply create a PHP file in the root directory which read the RSS file and echo its content.: // sitemap.php
$feeds = "feeds/rss.xml";
$read = fopen($feeds,"r");
$isi = fread($read,filesize($feeds));
echo $isi;
?>

Then I open my Google’s Webmaster Tool page and submit sitemap.php instead of my RSS file. And the best thing is, it works as I expected ^_*

 

Leave a Reply