Laravel controller says the Redirect class is not found
Class "App\Http\Controllers\Redirect" not foundShort answer
PHP looks for Redirect inside the controller's own namespace because the file never imports the facade. Add use Illuminate\Support\Facades\Redirect; at the top of the file, or call the redirect() helper, which needs no import. Facades only live in the Illuminate\Support\Facades namespace.
Fix it fast
1Find out which cause you have
The class name in the message starts with your own namespace. That tells you PHP found no import for it. Check the top of the file for a use line.
grep -n "Redirect" app/Http/Controllers/*.php2Match what you see, then jump to its fix
- 1
Class "App\Http\Controllers\Redirect" not found, at a line with Redirect::to() or Redirect::route().The Redirect facade is used but never importedFix - 2
The message names a class under another namespace, such as Illuminate\Support\Redirect or Illuminate\Http\Redirect.The facade is imported from a namespace that does not existFix
- 1
What does the error look like?
Class "App\Http\Controllers\Redirect" not foundClass 'App\Http\Controllers\Redirect' not found
Cause 1 of 2
The Redirect facade is used but never imported
1Check
In a namespaced file, a bare class name resolves inside that namespace. Laravel defines every facade in Illuminate\Support\Facades, so a controller must import it.
sed -n 1,15p app/Http/Controllers/PostController.php2Fix
Import the facade, or use the redirect() helper. The docs say a facade and its helper function are equivalent, and the helper needs no import.
use Illuminate\Support\Facades\Redirect;
return Redirect::route('posts.index');
// or, with no import
return redirect()->route('posts.index');3Verify
Request the route that returns the redirect and follow the Location header.
curl -I http://localhost:8000/posts/createConfirmed by laravel.com
Cause 2 of 2
The facade is imported from a namespace that does not exist
1Check
An editor auto-import or a copied snippet can pick the wrong namespace. The class behind the Redirect facade is Illuminate\Routing\Redirector, and the facade itself is in Illuminate\Support\Facades.
grep -rn "use .*Redirect" app/2Fix
Replace the import with the facade's real namespace.
use Illuminate\Support\Facades\Redirect;3Verify
No wrong import remains and the page loads.
grep -rn "use .*Redirect" app/Confirmed by laravel.com
How do I stop it coming back?
- Prefer the redirect() helper in controllers; it cannot hit this error.
- Let the IDE add imports, but read the namespace it picks before accepting it.
- Run a static analyser in CI so unknown classes fail the build.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
composer require maatwebsite/excel fails to install
Composer says the package needs an older PHP than the one installed
Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.
3 causes, each with a fixBack end
composer install says the lock file is not compatible and asks for update
Your lock file does not contain a compatible set of packages. Please run composer update.
composer install checked the locked packages against this machine's PHP and extensions and found a conflict.
3 causes, each with a fixBack end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
composer require laravel/passport stops with 'requirements could not be resolved'
... but these were not loaded, likely because it conflicts with another require.
Composer found no Passport release that fits your project at once.
4 causes, each with a fixBack end
Composer says the root composer.json requires a PHP version your PHP does not satisfy
Your requirements could not be resolved to an installable set of packages.
Composer compares the php constraint in your composer.json, or in a package, with the PHP that runs Composer.
3 causes, each with a fix