How to fix “Blocked by robots.txt” on Laravel
If Search Console shows “Blocked by robots.txt” on your Laravel site, you are in the right place. robots.txt stops Googlebot from fetching the URL. This page covers the causes and a step-by-step fix for Laravel. A PHP framework. SEO behaviour is entirely in your code; meta tags live in Blade templates and the sitemap comes from a package or a custom command.
Contents
What does this status mean?
A Disallow rule in your robots.txt forbids crawling this URL. Google cannot read the content; if other sites link to it, it can still appear in the index without content.
Likely causes on Laravel
- A "Disallow: /" rule added during development was forgotten live.
- A broad pattern (for example /*?) also catches pages you want.
- The CMS or a plugin rewrote robots.txt on its own.
- Sitemap URLs sit in folders closed by robots.txt.
- Laravel note: Edit public/robots.txt; if it is missing the framework returns 404. The web server root must be the public folder.
Step-by-step fix on Laravel
- In your Laravel admin go to: The Blade layout (head section), public/robots.txt, routes/web.php and the sitemap package configuration.
- Edit public/robots.txt; if it is missing the framework returns 404. The web server root must be the public folder.
- Use the Search Console robots.txt report or a robots tester to find which rule closes the URL.
- Narrow or delete the rule; close only folders that really should not be crawled.
- Verify that sitemap URLs do not conflict with robots.txt.
- After fixing, give Google a day to refresh its robots.txt cache or request a recrawl in the report.
- Send the URL for indexing and follow progress with URL inspection.
Extra checks for Laravel
- canonical and duplicate URLs: Output a canonical in the layout with url()->current() and leave query parameters out. For pagination, each page should carry its own canonical.
- redirects and 404: Define 301s with Route::permanentRedirect in routes/web.php. When an Eloquent model is not found call abort(404); do not return an empty page with 200.
After fixing
In Search Console start "Validate fix" for this status and resubmit the page with URL inspection. First confirm the blocker is gone with the free Free indexability checker tool; for many URLs follow Bulk URL indexing: how to send thousands of pages to Google. Google makes the indexing decision itself and timing ranges from days to weeks.
More information
Frequently asked questions
Does robots.txt remove a page from the index?
No. It blocks crawling, it does not remove from the index. To remove, allow crawling and use noindex.
How do I test robots.txt?
Enter the file and a URL in our free robots.txt tester to see the Googlebot allow status.
Where are these settings on Laravel?
The Blade layout (head section), public/robots.txt, routes/web.php and the sitemap package configuration.