iceblox Posted March 24, 2009 Share Posted March 24, 2009 Hi All, I found a script online to create an xml/php sitemap and i have got it working with the root page and a folder name but i cant get the script to pick up any content that has had the url rewriten.. Anyone know why this might be? Thanks, Phil Link to comment https://forums.phpfreaks.com/topic/150924-xmlphp-sitemaps-using-rewritten-htmls/ Share on other sites More sharing options...
Yesideez Posted March 24, 2009 Share Posted March 24, 2009 Not without some code and more of an explanation. Link to comment https://forums.phpfreaks.com/topic/150924-xmlphp-sitemaps-using-rewritten-htmls/#findComment-792887 Share on other sites More sharing options...
iceblox Posted March 24, 2009 Author Share Posted March 24, 2009 This is the full code [code<? $siteUrl = "http://www.thisurl.com/"; //Change below to all the pages of your website that you want inluded in your google sitemap, Then after the =>, insert the update frequency of that page. //They must be in single quotes seperated by commas and relative to your site root...... //eg. if the file is http://www.webhostingelite.com/contactform/contact.php, you would write "contactform/contact.php" //The order you place the values, the higher the priority it will be. $pages = array('' => 'daily','mobile-phone-deals/' => 'daily', 'Nokia-N95-Reviews-1.html' => 'daily'); //Initialize the xml $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">"; //Scroll through the pages $count = 0; foreach ($pages as $page => $freq) { if (file_exists($_SERVER['DOCUMENT_ROOT']."/".$page)) { $time = date('Y-m-d',filemtime($_SERVER['DOCUMENT_ROOT']."/".$page)); $xml .= "<url>\n"; $xml .= "<loc>{$siteUrl}{$page}</loc>\n"; $xml .= "<lastmod>{$time}</lastmod>\n"; $xml .= "<changefreq>{$freq}</changefreq>\n"; if ($count < 3) { $min = "0."; $min .= $count*2; $priority = number_format(1.0 - $min,1,".",","); } else { $priority = 0.5; } $xml .= "<priority>$priority</priority>"; $xml .= "</url>\n"; } $count++; } $xml .= "</urlset>"; header ("content-type: text/xml"); echo $xml; ?> So what i meant was i have a page lets say Nokia-N95-Reviews-1.html which is actually phones.php?modid=1 i put the re written url into the array and nothing shows up.. Im not sure why? Link to comment https://forums.phpfreaks.com/topic/150924-xmlphp-sitemaps-using-rewritten-htmls/#findComment-792894 Share on other sites More sharing options...
iceblox Posted March 24, 2009 Author Share Posted March 24, 2009 If i just put phones.php in it display that in the sitemap but wont display the url friendly one or just phones.php?modid=1 Not sure whats happening? Link to comment https://forums.phpfreaks.com/topic/150924-xmlphp-sitemaps-using-rewritten-htmls/#findComment-792951 Share on other sites More sharing options...
iceblox Posted March 25, 2009 Author Share Posted March 25, 2009 Does any one have any ideas? Or can someone point me in the right direction? Thanks, Phil Link to comment https://forums.phpfreaks.com/topic/150924-xmlphp-sitemaps-using-rewritten-htmls/#findComment-793425 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.