Sitemaps are useful to tell search engines about different pages of your website. Once you submit a sitemap to a search engine, they can crawl all the links which you provided in your sitemap. So generating a sitemap for your website is very important. If you don’t have a sitemap for your site, create one by Google Codes or manually create one by Learning how to create a sitemap (it’s nothing but a simple XML file!)
Now, there are two ways for making a scheduled update for your sitemap:
Automatic: By PHP & Cron Job
Download this PHP file. Give it a name, like “sitemap_updater.php”. Edit it to type in it the correct location of your sitemap. Now upload it to your server, suppose in /public_html/cron_jobs/ directory. Give the file a name, for example, sitemap_updater.php
Now, go to Cron job section of your server from the Control Panel/Admin account of your hosting. If you’ve acces to Cpanel, you may click cron jobs like following:
Next, click a option that suits you most. If you’re new, click standard
Next we’re on the main panel. Select your schedule – how often you want to run the code. Then in the command to run box, type the following command:
php -f /home/your-username/public_html/cron_jobs/sitemap_updater.php
Look at the URL: /home/your-username/public_html/ replace it with appropritae location of your root directory.
If you have a different location for the sitemap_updater.php file, type it accordingly. The following screen-shot might be helpful (ignore the command given in the image)!
More details on Cron jobs here
Download the Sitemap_Updater.php file
Manually Updating Site-maps
Well, if you don’t have access to PHP/Cron jobs, you can manually update sitemaps. The trick is, we will create a HTML file, save it in our local disk, and run the file manually whenever we need to update the sitemap!
- Download this HTML file
- Rename it like something.html
- Open the file for editing, edit line # 5, give here your sitemap address. Save it
- Now whenever you need to update your sitemap, just open the HTML file in your brower!🙂
Well, that’s all. Rock with your sitemaps😀