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.

Owner
Tanish Raj
Founder & CFO @Niotron
Tanish Raj
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

Guillaume Boudreau 225 Nov 18, 2021
Block malicious scripts using botscout.com protection for your laravel app

Laravel BotScout Protect your website against automated scripts using the botscout.com API. Installation You can install the package via composer: com

Nicolas Beauvais 67 Oct 4, 2021
You have just downloaded "Messenger-app" [A lightweight, minimalistic real-time chat application]

MESSENGER-APP You have just downloaded "Messenger-app" [A lightweight, minimalistic real-time chat application] Setup To get it working, follow these

Chr1st0ph3r SAB 1 Oct 29, 2021
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

CHINO TECH TOOLS 3 Sep 6, 2021
🌏 Webnux 🌏 , a videos streaming website where you can watch what you want when you want.

?? WEBNUX ?? Welcome to ?? Webnux ?? , a videos streaming website where you can watch what you want when you want. ☀️ ☀️ OBJECTIFS ☀️ ☀️ - A sessi

FrancisNtahimpera 1 Nov 23, 2021
Task for GrumPHP that adds CSS linting support with stylelint. An easy way to enforce convention and avoid errors in your styles

grumphp-stylelint-task Installation Stylelint is a static analysis tool for styles. A mighty, modern linter that helps you avoid errors and enforce co

null 3 Apr 29, 2021
Simple library that abstracts different metrics collectors. I find this necessary to have a consistent and simple metrics (functional) API that doesn't cause vendor lock-in.

Metrics Simple library that abstracts different metrics collectors. I find this necessary to have a consistent and simple metrics API that doesn't cau

Benjamin Eberlei 305 Oct 26, 2021
Aplicación de chat usando HTML, CSS, PHP, JS and MySQL.

SYSTEMSGT Codigo fuente de aplicación CHAT - SYSTEMSGT Lenguajes HTML CSS PHP JS MySQL Pre-requisitos ?? Para poder utilizar esta aplicación necesitas

SYSTEMSGT 36 Oct 27, 2021
Michael Pratt 292 Nov 19, 2021
This Statamic addon allows you to modify the tags rendered by the Bard fieldtype, giving you full control over the final HTML.

Bard Mutator This Statamic addon allows you to modify the tags rendered by the Bard fieldtype, giving you full control over the final HTML. You can ad

Jack Sleight 5 Nov 23, 2021
Fly50W is a new language which helps you build simple apps using more than 500k lines of code easily.

Fly50W is a new language which helps you build simple apps using more than 500k lines of code easily. Installation

null 4 Nov 7, 2021
MOP is a php query handling and manipulation library providing easy and reliable way to manipulate query and get result in a fastest way

Mysql Optimizer mysql optimizer also known as MOP is a php query handling and manipulation library providing easy and reliable way to manipulate query

null 1 Nov 18, 2021
PHP library to create and validate html forms

FormManager Note: this is the documentation of FormManager 6.x For v5.x version Click here Installation: This package requires PHP>=7.1 and is availab

Oscar Otero 139 Sep 29, 2021
This shell script and PHP file create a browseable HTML site from the Zig standard library source.

Browseable Zig standard library This shell script and PHP file create a browseable HTML site from the Zig standard library source. The idea is to inve

Dave Gauer 3 Sep 2, 2021
A class to help convert bytes into other units (kb, mb, etc).

A class to help convert bytes into other units (kb, mb, etc). This package can be used to convert int|float values from bytes to KB, MB and GB as well

Ryan Chandler 12 Aug 30, 2021
A set of classes to create and manipulate HTML objects abstractions

HTMLObject HTMLObject is a set of classes to create and manipulate HTML objects abstractions. Static calls to the classes echo Element::p('text')->cla

Emma Fabre 129 Nov 6, 2021
A Symfony Feature Flag Bundle which easily allows you to configure and use your favorite feature flag provider.

Metro Markets FF Metro Markets FF is a Feature Flag Symfony Bundle. It easily allows you to configure and use your favorite feature flag provider. Ins

METRO Markets 13 Jul 26, 2021
salah eddine bendyab 18 Aug 17, 2021