انتقل إلى المحتوى

الدروس بناء المواقع مبتدئ1 دقائق قراءة

How to Create a robots.txt File

Write a correct robots.txt: allow and disallow crawling, link your sitemap, avoid blocking CSS and JS, and test it before search engines read it.

بواسطة فريق تحرير ZSOLNET آخر تحديث

هذه الصفحة غير متاحة بالعربية بعد، لذا تُعرض بالإنجليزية.

أهم النقاط

  • robots.txt tells crawlers which paths they may fetch.
  • Disallowing a page doesn't remove it from search — use noindex for that.
  • A single wrong line can hide your whole site from search engines.

A sensible default

User-agent: *
Disallow:

Sitemap: https://example.com/sitemap.xml

An empty Disallow: allows everything. The Sitemap line helps crawlers find your pages.

WordPress example

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://example.com/wp-sitemap.xml

Rules to remember

  • Paths are case-sensitive and match by prefix: Disallow: /private also blocks /private-offers.
  • * matches any characters and $ anchors the end: Disallow: /*.pdf$.
  • Don’t block CSS, JavaScript or images — search engines need them to render pages.
  • Disallow: / blocks the whole site. Staging sites use it; production sites almost never should.

Create and test

  1. Generate a file with the robots.txt generator or write it by hand.
  2. Upload it to your site’s document root (public_html).
  3. Check it with the robots.txt checker and in Search Console’s robots.txt report.

الأسئلة الشائعة

Where does robots.txt go?

At the root of the host: https://example.com/robots.txt. Each subdomain needs its own.

Can robots.txt keep private files secret?

No. It's public and only advisory. Protect private files with passwords or by not putting them on the public web server.

شارك X LinkedIn Facebook

الدخول إلى حسابك

أدِر نطاقاتك واستضافتك وفواتيرك من مكان واحد.

اتصال آمن مباشرة مع منطقة العملاء في ZSOLNET.

افتح لوحة تحكم ZSOLNET

ليس لديك حساب؟