The simplest way to create a dynamic sitemap for your self-coded website which you have made by using PHP/HTML/CSS/Js etc... Scripts.

Overview

Sitemap_index.xml

The simplest way to create a dynamic sitemap for your self-coded website which you have made by using PHP/HTML/CSS/Js etc... Scripts.

As we already know, for creating XML Sitemap for a static website, there are a lot of online tools avaialbe out there. But here we have created a dynamic XML sitemap generator by using a simple PHP Script for Google and other search engines.

💡 Why do we need this script instead of the tools that are already available?

Before I answer this, Let's understand what is Sitemap in simple very terms. XML Sitemap is a series of webpage URLs that can be accessible by search engine crawlers and users. Based on Sitemap, search engines will index website pages and display them accordingly. So if you want to index your website web page on a Search engine then you have to create a sitemap for your website and submit it to the search console.

Once you upload the sitemap_index.php in the root or public_html directory. Each time a search engine crawler makes a request to get the updated sitemap of your webiste the script will generate the site map and return the updated sitemap. So even if you make any change on your website by creating a new page or directory the search engine will get the info of that via that XML sitemap.

If you use any other site map generator tool then you have to do it manually by creating and uploading the updated sitemap_index.xml file everyday for the serach console. But this script will automaet the work as it generates the Sitemap when a search engine crawlers make reuqet to get the sitemap. Isn't this amazing 😅

If you want to know more about the sitemap and sitemap format visit sitemap.org

🛠 How to use this?

Usage is pretty strait forward, simply upload the sitemap_index.php in the root or public_html directory. Now open this file and make these changes

$root = "https://yourdomain.com";
  • skip_dir is the array containing all those directories that we don't want to list in our sitemap.
  • skip_files is the array containing all those files that we don't want to list in our sitemap.
  • and skip_file_extensions is the array containing all the file extensions of the files that we don't want to list in our sitemap.
$skip_dir = array(
	".well-known", "cgi-bin"
);

$skip_files = array(
	"sitemap_index.php", "test_codes.php"
);

$skip_file_extensions = array(
	"html", "xml", "zip", "txt"
);
  • Now open the .htaccess file (create one if you don't have in root directory) and insert these codes and save it.
RewriteEngine On
RewriteRule ^sitemap_index\.xml/?$ sitemap_index.php

🥳 Congratulations you have successfully created your own dynamic sitemap generator. To test this, Simply go to https://yourdomain.com/sitemap_index.xml you can now submit this url to search engnes to provide updated sitemap of your webitse each time to the search engine crawlers.

You can get such other tools here on my GitHub or visit my website Cttricks for more.

You might also like...
A real-time chatting website using HTML, CSS, JavaScript, PHP
A real-time chatting website using HTML, CSS, JavaScript, PHP

ChatApp A real-time chatting website using HTML, CSS, JavaScript, PHP #Features Signup Login Signup & Login Validation Encrypted Password Realtime Mes

PHP Sitemap Generator

This class can be used to generate sitemaps and notify updates to search engines.

A PHP sitemap generation tool.

Cartographer A sitemap generation tool for PHP following the Sitemap Protocol v0.9. Cartographer can handle Sitemaps of any size. When generating site

Laravelium Sitemap generator for Laravel

Laravelium Sitemap package Laravelium Sitemap generator for Laravel. Notes Dev Branches are for development and are UNSTABLE (use on your own risk)! I

Proxy Judge coded In PHP

Simple proxy judge created in PHP What is a Proxy Judge ? A ProxyJuge is usually a PHP script that returns a subset of the environment variables of th

A Magento 1.x module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN, Varnish, etc using best practices outlined within the HTML5 boilerplate community.

Magento Cachebuster Cachebuster is a Magento module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN,

My intention with this app is that new developers can have a concrete application with Laravel + VueJS where they can use it as example to learn the right way
My intention with this app is that new developers can have a concrete application with Laravel + VueJS where they can use it as example to learn the right way

My intention with this app is that new developers can have a concrete application with Laravel + VueJS where they can use it as example to learn the right way, implementing the best practices possible and at the same time learn how TDD is done. So this will be an example application but completely usable for any similar case.

Greyhole uses Samba to create a storage pool of all your available hard drives, and allows you to create redundant copies of the files you store.

Greyhole Greyhole is an application that uses Samba to create a storage pool of all your available hard drives (whatever their size, however they're c

Talkino allows you to integrate multi social messengers and contact into your website and enable your users to contact you using multi social messengers' accounts.

Talkino Welcome to our GitHub Repository Talkino is a click to chat plugin to show your agents’ multiple social messengers, phone and emails on the ch

Owner
Tanish Raj
Founder & CFO @Niotron
Tanish Raj
It is a simple blog application coded with PHP, HTML, CSS. You can develop, edit. You can see it as a skeleton. ⚡

PHP-BLOG-SYSTEM Simple blog system Features Adding Text Update Text Text Deletion User Login and register Bootstrap Design Profile Page How to use blo

Selçuk 2 Aug 21, 2022
Online Food Delivery Website created using HTML, CSS, PHP and MySQL which delivers food at your doorstep on Cash-On-Delivery.

Food-Delivery-Website Online Food Delivery Website created using HTML, CSS, PHP and MySQL which delivers food at your doorstep on Cash-On-Delivery. Th

null 2 Dec 1, 2022
Laravel Blog Package. Easiest way to add a blog to your Laravel website. A package which adds wordpress functionality to your website and is compatible with laravel 8.

Laravel Blog Have you worked with Wordpress? Developers call this package wordpress-like laravel blog. Give our package a Star to support us ⭐ ?? Inst

Binshops 279 Dec 28, 2022
Shortest Path - have a function ShortestPath (strArr) take strArr which will be an array of strings which models a non-looping Graph.

Have the function ShortestPath(strArr) take strArr which will be an array of strings which models a non-looping Graph

null 1 Feb 5, 2022
A collection of command line scripts for Magento 2 code generation, and a PHP module system for organizing command line scripts.

What is Pestle? Pestle is A PHP Framework for creating and organizing command line programs An experiment in implementing python style module imports

Alan Storm 526 Dec 5, 2022
A set of PHP scripts which leverage MySQL INFORMATION_SCHEMA to create log tables and insert / update triggers

mysql-logtable-php mysql-logtable-php is a set of PHP scripts which leverage MySQL INFORMATION_SCHEMA to create log tables and insert / update trigger

null 3 Feb 27, 2022
Composer plugin replacing placeholders in the scripts section by dynamic values

Composer Substitution Plugin The Composer Substitution plugin replaces placeholders in the scripts section by dynamic values. It also permits to cache

Fabien Villepinte 49 Jan 8, 2022
It's basically a dynamic web browser extension that can display notifications with the help of an admin-controlled dynamic API.

D-NOTIFIER A self controlled dynamic API based web browser extension built by Sahil Kumar How It Works? It's basically a dynamic web browser extension

Sahil Kumar 1 Jan 6, 2022
Learning about - Basic HTML & CSS, JSON, XML, Session & Cookies, CRUD Operations in Php using MySQL and Create MVC from scratch

This Project is based on course CSC 3215. Learning about - Basic HTML & CSS, JSON, XML, Session & Cookies, CRUD Operations in Php using MySQL and Create MVC (Model–View–Controller) from scratch. Just learning about web technologies, Not focusing on UI (Bootstrap or other 3rd-Party UI libraries or frameworks).

Alvi Hasan 5 Sep 21, 2022
The main website source code based on php , html/css/js and an independent db system using xml/json.

jsm33t.com Well umm, a neat website LIVE SITE » View Demo · Report Bug · Request a feature About The Project Desc.. Built Using Php UI Frameworks Boot

Jasmeet Singh 5 Nov 23, 2022