maxdome
Chevereto Member
Hi, I wrote this script to generate a Cheverote sitemap.xml file.
Its executed via a cron job and seems to be working perfectly.
Step-1: This script will generate a sitemap.xml file with existing category names fron Your Chevereto.
Step-2: Create a new file and save it as sitemap.php
Step-3: Upload a sitemap.php file in your Cheverote home web - (FTP)
Step-4: For the Cron Job..
ROOT: crontab -e
USER: crontab -u USER -e
add this script:
Remember to change the domain www.yourdomain.com with your Cheverote Domain.
If you want to test the script without the Cron Job, disable this line in the php:
and enter this URL in your Browser: http://www.yourdomain.com/sitemap.php
Step-5: Check the FTP and see a file created with the name sitemap.xml
*You can add more options for sitemap.php, for example Users Public Albums
DEMO: https://zupics.com/sitemap.xml
----------------------------------------------------------------------------------------------------------------------
PLEASE READ THIS:
Sitemap.xml, on the other hand, is a file where you list all of the pages of your website.
It tells the search engines – Google, Bing, Yahoo and others about the pages, images, videos and grouping of your site content.
Search engine web crawlers such as Googlebot read the sitemap.xml and indexed your site to their search directories.
Create an XML sitemap that can be submitted to Google, Bing, Yahoo and other search engines to help them crawl your website better.
How do you submit sitemap.xml to the search engines?
Due to time limitation, I will limit my response to submitting sitemap.xml to only Google.
Submitting your sitemap.xml to Google Webmaster Tools
This in return creates a significant impact on a business sales and bottom line.
If your business’ website doesn’t have a sitemap.xml, you’re most likely leaving money on the table.
-----------------------------------------------------------------------------------------------------------------------
Good Luck
If you liked my idea, please click the "like" button
Best Regards:
Gio
Its executed via a cron job and seems to be working perfectly.
Step-1: This script will generate a sitemap.xml file with existing category names fron Your Chevereto.
PHP:
<?php
if (!defined('BASEPATH')) exit('This script is read by the Cron System. The Browser access is blocked. ');
$localdb="localhost"; // Your Hostname (default is localhost)
$userdb="username"; // Your Database Username
$passdb="password"; // Your Database Password
$mysqldb="database"; // Your Database Name
$WebUrl="http://www.mydomain.com"; // Your Cheverote Domain without(/)
$catfolder="category"; // Do not change anything here
$dbconection = mysql_connect($localdb, $userdb, $passdb );
mysql_select_db($mysqldb, $dbconection);
$sqlget = "SELECT category_url_key FROM chv_categories";
$resuldata = mysql_query($sqlget,$dbconection);
$priority = '0.7';
$changefreq = 'weekly';
$datem = date("Y-m-d");
$codtgetdata='<?xml version="1.0" encoding="iso-8859-1"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
while ($rowdata = mysql_fetch_array($resuldata)){
$codtgetdata .='<url>
<loc>'.$WebUrl.'/'.$catfolder.'/'.$rowdata["category_url_key"].'</loc>
<lastmod>'.$datem.'</lastmod>
<changefreq>'.$changefreq.'</changefreq>
<priority>'.$priority.'</priority>
</url>';
}
$codtgetdata .='</urlset> ';
$path = "sitemap.xml";
$modo = "w+";
if ($fpen=fopen($path,$modo)){
fwrite ($fpen,$codtgetdata);
echo "<p><b>Sitemap successfuly created and saved to sitemap.xml!</b>";
}else{
echo "<p><b>There has been a problem and the file has not been created.</b>";
}
mysql_free_result($resuldata);
mysql_close($dbconection);
?>
Step-2: Create a new file and save it as sitemap.php
Step-3: Upload a sitemap.php file in your Cheverote home web - (FTP)
Step-4: For the Cron Job..
ROOT: crontab -e
USER: crontab -u USER -e
add this script:
This cron job start the script every day 12:30 h. You can change the time to any time you want.30 12 * * * curl http://www.yourdomain.com/sitemap.php > /dev/null 2>&1
Remember to change the domain www.yourdomain.com with your Cheverote Domain.
If you want to test the script without the Cron Job, disable this line in the php:
PHP:
//if (!defined('BASEPATH')) exit('This script is read by the Cron System. The Browser access is blocked. ');
Step-5: Check the FTP and see a file created with the name sitemap.xml
*You can add more options for sitemap.php, for example Users Public Albums
DEMO: https://zupics.com/sitemap.xml
----------------------------------------------------------------------------------------------------------------------
PLEASE READ THIS:
Sitemap.xml, on the other hand, is a file where you list all of the pages of your website.
It tells the search engines – Google, Bing, Yahoo and others about the pages, images, videos and grouping of your site content.
Search engine web crawlers such as Googlebot read the sitemap.xml and indexed your site to their search directories.
Create an XML sitemap that can be submitted to Google, Bing, Yahoo and other search engines to help them crawl your website better.
How do you submit sitemap.xml to the search engines?
Due to time limitation, I will limit my response to submitting sitemap.xml to only Google.
Submitting your sitemap.xml to Google Webmaster Tools
- Register for Google Webmaster Tools
- On your Webmaster Tools home page, register and select your website.
- In the left sidebar, click Site configuration and then Sitemaps.
- Click the Add/Test Sitemap button in the top right.
- Enter sitemap.xml into the text box that appears.
- Click Submit Sitemap.
- Click “Refresh”.
This in return creates a significant impact on a business sales and bottom line.
If your business’ website doesn’t have a sitemap.xml, you’re most likely leaving money on the table.
-----------------------------------------------------------------------------------------------------------------------
Good Luck
If you liked my idea, please click the "like" button
Best Regards:
Gio
Last edited: