Sub topic 8
Scoping a Crawl: Include and Exclude Rules, Limits, User-Agent and Speed
This chapter assumes you can run a basic crawl (see the first-crawl chapter) and that you know what a regular expression is, what robots.txt does, and how HTTP status codes work. You also need permission to crawl the site.
A default crawl starts at one URL and follows every internal link it finds. On a small site that is fine. On a larger site, faceted navigation, session IDs, calendars and search result pages can generate thousands of near-duplicate URLs. Scoping tells the SEO Spider which URLs to visit, how many, how deep, and how hard to push the server.
What scope controls
Most scoping settings live under the Configuration menu. Each one answers a different question.
| Question | Setting | Menu location |
|---|---|---|
| Which URLs should be skipped? | Exclude | Configuration > Exclude |
| Which URLs are the only ones to crawl? | Include | Configuration > Include |
| How many URLs, how deep? | Limits | Configuration > Spider > Limits |
| Does the crawl obey robots.txt? | Robots.txt settings | Configuration > robots.txt |
| Who does the server think is visiting? | User-Agent | Configuration > User-Agent |
| How fast does it fetch? | Speed | Configuration > Speed |
Menu names can shift slightly between versions, so use the search in the configuration dialog if you cannot find one.
Exclude rules
An Exclude rule is a regular expression matched against the full URL. If it matches, the SEO Spider does not request the URL. Excluded URLs do not appear in the crawl results, so you cannot see them later without changing the rule.
Enter one regex per line. The pattern must match the whole URL, so patterns usually start and end with .*.
.*\?sessionid=.*This rule skips any URL containing a sessionid query parameter. Some more examples:
.*/basket/.*skips every URL under a basket path..*\.pdf$skips PDF files..*[?&]sort=.*skips sorted listing variants.
Escape special characters. A literal ? or . needs a backslash, otherwise ? makes the previous character optional and . matches anything.
The Test tab in the Exclude dialog lets you paste a URL and see whether any rule matches it. Use it before starting a long crawl.
Include rules
An Include rule works the other way round. Only URLs matching at least one rule are crawled. Everything else is ignored.
Use Include when you want to audit one section, for example:
https://www.example.com/products/.*There is an important catch. The starting URL must also match an Include rule, or the crawl finds nothing and stops. Include rules also apply to discovery, so pages in the section that are linked only from outside it will not be found. If the products section is reached through the home page, start the crawl at a URL inside /products/ instead.
When both lists are set, an Exclude rule takes precedence. A URL that matches Include and Exclude is skipped.
Include and Exclude are not available in List mode, where you supply the URLs yourself.
Limits
Limits cap the crawl by size or shape. They are useful for a quick sample, or to stop a crawl running away on a site you have not seen before.
| Limit | What it does | Typical use |
|---|---|---|
| Limit Crawl Total | Stops after N URLs | A quick sample of a large site |
| Limit Crawl Depth | Does not follow links beyond N clicks from the start page | Check only important, shallow pages |
| Limit Max Folder Depth | Limits URL path depth | Avoid deeply nested paths |
| Limit Number of Query Strings | Caps URLs with parameters | Stop faceted navigation explosions |
| Max Redirects to Follow | Caps redirect hops followed per URL | Surface long redirect chains |
| Max URL Length to Crawl | Skips very long URLs | Skip generated junk URLs |
A limited crawl is a sample, not a full audit. Counts such as "pages with missing titles" are only true for the URLs that were actually crawled.
Robots.txt handling
By default the SEO Spider obeys robots.txt, as a search engine would. URLs blocked this way are listed with a status of "Blocked by robots.txt" but are not fetched.
For your own site you can change this under Configuration > robots.txt:
- Respect robots.txt is the default and shows what a search engine can reach.
- Ignore robots.txt crawls everything, which helps when you want to audit pages that are currently blocked, for example a staging area you are about to open.
- Ignore robots.txt but report status crawls blocked URLs and still flags them as blocked, so you see both sides.
Use the ignore options only on sites you own or have explicit permission to crawl. The robots.txt tab and the Indexability chapter cover how to read blocked URLs in the results.
User-agent
The user-agent is the name the crawler sends in each request. Under Configuration > User-Agent you can pick Googlebot, Bingbot, a browser, or the default Screaming Frog string.
Changing it is useful for two reasons:
- Some servers and CDNs return different content or block unknown agents. Crawling as Googlebot shows what a search engine is served.
- Robots.txt rules are per agent. The SEO Spider applies the rules for the selected agent, so a Googlebot-specific
Disallowonly takes effect when you crawl as Googlebot.
Setting the user-agent to Googlebot only changes the header. The requests still come from your IP address, not Google's. A firewall that verifies Googlebot by IP will still treat you as a stranger. If your site blocks you, ask the site's operator to allow your IP rather than trying to disguise the crawler.
Speed
Under Configuration > Speed you set the maximum number of threads and, optionally, a maximum URLs per second. More threads means a faster crawl and more load on the server.
- Start with the default thread count on production sites.
- If response times climb or you see 429 or 5xx status codes, lower the threads or set a URL-per-second cap.
- Slow servers can produce timeouts that look like real errors. Crawl again more gently before you report them.
- Crawl at off-peak hours if the site is busy and the server is small.
You can adjust the speed while a crawl is running. This is useful if you notice the server struggling.
A scoping recipe
For a new, unfamiliar site, this order works well:
- Run a small limited crawl, for example the first 500 URLs.
- Look at the Internal tab sorted by Address. Spot repeating patterns such as parameters or calendar paths.
- Write Exclude rules for those patterns and check them with the Test tab.
- Check the user-agent and robots.txt settings.
- Set a sensible speed.
- Clear the crawl and run the full crawl.
Common mistakes
- Rules that never match. A pattern without leading and trailing
.*does not match the whole URL, so nothing is excluded. - Unescaped dots and question marks.
.*?sessionid=.*does not mean what you expect. Use\?. - Include rules with the wrong start URL. The crawl ends with one URL.
- Forgetting settings are saved. Configuration persists between crawls unless you reset it. Check Exclude and Limits before every new audit.
- Treating a limited crawl as complete. Counts only describe the crawled set.
Exercise
You want to crawl only the /help/ section of https://www.example.com but skip any URL that has a ?print=1 parameter. Write the Include and Exclude rules, and say which URL you should use as the start URL.
Show answer
Include: https://www.example.com/help/.*. Exclude: .*\?print=1.*. Start the crawl at https://www.example.com/help/ (or another URL inside the section), because the start URL must match an Include rule and the home page does not. A URL matching both rules is skipped, since Exclude takes precedence.
Exercise
Your crawl shows many 503 responses and the server owner reports high load. Which two settings do you change, and what should you do about the 503 results already in the report?
Show answer
Lower the number of threads and set a maximum URLs-per-second limit under Configuration > Speed. The 503 results may be caused by the crawl itself, so re-crawl those URLs at the gentler speed before reporting them as real errors.