![]() |
![]() |
You have a large website consisting of dynamic pages populated from a MySql database but how do you create a sitemap?
There are many great sites out there that will do the job for you such as https://www.xml-sitemaps.com/ however many of these have a maximum of 500 pages.
Your site is database driven so why not use a database to create the sitemap.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.mysite.com/mypage.php?id=1</loc>
<lastmod>2014-05-10</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
Go to your phpMyAdmin and download the table your URL indexes are stored in. Remember to change the semicolon ‘;’ to a comma ‘,’.
Open Microsoft Access and import the CSV file using the text import wizard.
Create a new query and add your table, now create the following expression, changing Field1to the column that contains your indexes, change the URL to your dynamic page and change the date to the present.
Expr1: "<url><loc>https://www.mysite.com/mypage.php?id=" & [Field1] & "</loc><lastmod>2014-08-01</lastmod>changefreq>monthly</changefreq><priority>0.5</priority></url>"
Run the query and you should get your xml formatted correctly.
Now save and export your query to text, choose a tab separator and change the text qualifier to none.
Open your exported text file and paste the following to the beginning.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
Paste the following to the end.
</urlset>
Now save as sitemap.xml and your page is ready to upload and submit to Google.
Keywords: Google, Sitemap, XML, Dynamic
Latest Posts |
| 27/04/20 |
| How to Make a Model Anderson Shelter |
| 25/04/20 |
| How to make a Model Roman Villa |
| 15/04/20 |
| How to Make a Tetrahedron |
| 07/04/20 |
| Octahedrons and how to draw their net |
| 17/11/15 |
| How to Create a Time Sheet in Excel |
| 15/11/15 |
| Handling time and dates in PHP |
| 03/02/15 |
| How to Enhance Photographs with the Gimp |
| 25/01/15 |
| How to Cook Pigeon |
| 25/01/15 |
| Telling the Time |
| 24/01/15 |
| An Old Travel Card |