दिन 5: Technical SEO – robots.txt, Sitemap, Canonical
✅ आज आप सीखेंगे
- robots.txt से crawling नियंत्रित करना
- XML sitemap से discovery में मदद
- Canonical tags से duplicates से बचना
- noindex, 301 redirects और status codes सही इस्तेमाल
- hreflang और basic structured data जोड़ना
🏢 असली दुनिया में
Institute ने अपनी site http://www.sharmacomputers.example/tally-course.html से https://sharmacomputers.example/courses/tally/ पर shift की। अब Google को home page के चार versions दिखते हैं, पुराने links 404 errors देते हैं, और Hindi page English page से मुक़ाबला करता है। Technical SEO कुछ lines में यह सब ठीक करता है।
robots.txt – क्या crawl हो सकता है
robots.txt root पर (/robots.txt) होता है और crawlers को बताता है कि कौन से paths crawl न करें। यह security tool नहीं है और page को Google से नहीं हटाता – दूसरी sites link करें तो blocked page भी दिख सकता है। Page को results से बाहर रखने के लिए noindex लगाएँ और उसे crawl होने दें।
User-agent: * Disallow: /admin/ Disallow: /account/ Allow: / Sitemap: https://sharmacomputers.example/sitemap.xml
Disallow: / पूरी site रोक देता है। Development के बाद यह अक्सर रह जाता है – हर launch के बाद robots.txt जाँचें।
XML sitemap – क्या मिलना चाहिए
Sitemap उन URLs की list है जिन्हें आप index करवाना चाहते हैं (सिर्फ़ canonical, indexable, 200-status pages)। इसे Search Console (Day 7) में submit करें और robots.txt में बताएँ। lastmod ईमानदार रखें – तभी बदलें जब content सच में बदले।
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://sharmacomputers.example/courses/tally/</loc>
<lastmod>2026-10-20</lastmod>
</url>
<url>
<loc>https://sharmacomputers.example/courses/python/</loc>
<lastmod>2026-09-12</lastmod>
</url>
</urlset>Canonical, noindex और hreflang
| समस्या | सुधार |
|---|---|
| हर page के http://, https://, www और non-www versions | सबको एक version पर 301-redirect (नीचे) और self-referencing canonical |
| ?utm_source= या sorting parameters वाला वही page | साफ़ URL पर canonical |
| Thank-you page, internal search results, login | noindex (और sitemap में नहीं) |
| एक ही page के English और Hindi versions | दोनों pages पर एक-दूसरे की ओर hreflang en/hi, और x-default |
<!-- the preferred URL of this page --> <link rel="canonical" href="https://sharmacomputers.example/courses/tally/"> <!-- English and Hindi versions of the same page --> <link rel="alternate" hreflang="en" href="https://sharmacomputers.example/courses/tally/"> <link rel="alternate" hreflang="hi" href="https://sharmacomputers.example/hi/courses/tally/"> <link rel="alternate" hreflang="x-default" href="https://sharmacomputers.example/courses/tally/"> <!-- keep a page out of Google (e.g. thank-you page) --> <meta name="robots" content="noindex, follow">
Status codes और redirects
| Code | मतलब | SEO उपयोग |
|---|---|---|
| 200 | OK | सामान्य page |
| 301 | स्थायी रूप से हटा | Page हमेशा के लिए shift – signals नए URL को |
| 302 / 307 | अस्थायी | सिर्फ़ थोड़े समय के लिए (जैसे sale page) |
| 404 | नहीं मिला | बिना विकल्प हटाया page – सच में हटा हो तो ठीक; मिलता-जुलता page हो तो redirect |
| 410 | Gone | जान-बूझकर हमेशा के लिए हटाया |
| 5xx | Server error | जल्दी ठीक करें – बार-बार errors से crawling धीमी |
# Force HTTPS and one host name (Apache .htaccess)
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://sharmacomputers.example%{REQUEST_URI} [L,R=301]
# Old URL moved permanently to the new one
Redirect 301 /tally-course.html /courses/tally/HTTPS और structured data
HTTPS ज़रूरी है – browsers HTTP pages को “Not secure” दिखाते हैं और यह हल्का ranking signal है। Structured data (schema.org वाला JSON-LD) page को machine-readable तरीके से बताता है और rich results के लायक बना सकता है। सिर्फ़ वही जोड़ें जो page पर सच और दिखता हो, और Google के Rich Results Test से जाँचें।
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "EducationalOrganization",
"name": "Sharma Computer Institute",
"url": "https://sharmacomputers.example/",
"logo": "https://sharmacomputers.example/images/logo.png",
"telephone": "+91-00000-00000",
"address": {
"@type": "PostalAddress",
"streetAddress": "Shop 4, Example Market",
"addressLocality": "Aligarh",
"addressRegion": "Uttar Pradesh",
"postalCode": "202001",
"addressCountry": "IN"
}
}
</script>कौन से rich result types दिखें यह Google तय करता है। जैसे, FAQ और HowTo rich results अब बहुत कम sites के लिए दिखते हैं। समय लगाने से पहले Google Search Central में supported structured-data features की list देखें।
हल किए उदाहरण
उदाहरण 1: Migration की जाँच
| लक्षण | कारण | सुधार |
|---|---|---|
| पुराने /tally-course.html links 404 देते हैं | URL बदलने के बाद redirect नहीं | Redirect 301 /tally-course.html /courses/tally/ |
| Search Console: “Duplicate without user-selected canonical” | http/https और www/non-www सब चालू | 301 से एक host + self canonical |
| 3 हफ़्ते बाद भी नए course pages indexed नहीं | Sitemap में नहीं और internal links नहीं | Sitemap में जोड़ें, /courses/ और home page से link करें |
| पूरी site Google से ग़ायब | Staging से बचा robots.txt Disallow: / | हटाएँ, फिर मुख्य pages की indexing request करें |
अभ्यास प्रश्न (बिना हल – उत्तर छिपा है)
हर प्रश्न पहले ख़ुद करें – कागज़ पर, text editor में या अपनी site पर – फिर उत्तर खोलकर जाँचें।
🏋️ Practice – ख़ुद करें
Solution देखें
User-agent: * Disallow: /cart/ Disallow: /search/ Allow: / Sitemap: https://sharmacomputers.example/sitemap.xml
Solution देखें
(a) 301 (b) 302 (अस्थायी) (c) मुख्य article पर canonical (d) noindex।Solution देखें
<link rel="alternate" hreflang="en" href="https://sharmacomputers.example/courses/python/"> <link rel="alternate" hreflang="hi" href="https://sharmacomputers.example/hi/courses/python/"> <link rel="alternate" hreflang="x-default" href="https://sharmacomputers.example/courses/python/">
यही set English और Hindi दोनों pages पर लगाएँ।
🏅 आज के Job Skills
Quick quiz
🧠 Quick Quiz – ख़ुद को जाँचें
Interview corner
💼 Interview Corner
robots.txt Disallow और noindex में क्या अंतर है?
Disallow crawling रोकता है पर links से URL फिर भी index हो सकता है; noindex Google को page crawl करने देता है और results में न दिखाने को कहता है। De-index के लिए noindex लगाएँ और page block न करें।
Site migration कैसे संभालते हैं?
हर पुराने URL को सबसे नज़दीकी नए URL से map करें, 301 redirects लगाएँ, internal links और canonicals बदलें, robots.txt खुला रखें, नया sitemap submit करें, और Search Console में 404s और coverage बदलाव देखते रहें।
सारांश
- robots.txt crawling नियंत्रित करता है, indexing नहीं।
- Sitemap में canonical, indexable URLs।
- हर URL का एक version: 301 + canonical; भाषाओं के लिए hreflang।
- HTTPS हमेशा; structured data सिर्फ़ सच्चे, दिखने वाले तथ्यों के लिए।
Day 6: page speed, mobile-friendliness और Core Web Vitals (LCP, INP, CLS)।
