Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Max100's avatar

Laravel 8 - web.php not working

Using Laragon (Windows 10) I created a new Laravel project which installs the latest version.

I then went through the process of implementing Laravel UI, as I have done before without a problem.

1 composer require laravel/ui 2 php artisan ui vue --auth 3 npm install && npm run dev 4. php artisan migrate

But the starting page doesn't change. After exploring, I realized that the problem may be in the routing in web.php. For example, I tried the following in web.php:

Route::get('/', function () { // return view('welcome'); dd('got here'); });

Route::get('/testit', function() { dd('testing'); });

The '/' route still goes to the Laragon start page rather than the dd(). The '/testit' route comes back with a 404 error.

Something's wrong with the configuration, but I don't know what it is. I know there were changes to Laravel 8 routing, but don't know if that has anything to do with it.

What used to work when setting up a new project doesn't seem to work anymore.

Any ideas what's going wrong?

Thank you.

0 likes
18 replies
jlrdw's avatar

Check your ui version is correct. Also check laravel change logs to see routing changes.

Max100's avatar

@jlrdw Thank you for your reply! In the composer.json file it says: "laravel/ui": "^3.3", which I think is the latest version.

The main change to the routing seems to be related to naming controllers and a path prefix? I'm not sure how this affects things. I tried uncommenting the namespace var in the RouteServiceProvider.php file, but it didn't do anything, so I put it back the way it was.

Max100's avatar

@MohamedTammam Thank you for your reply! I tried each of the artisan commands you suggested, but the problem is still there.

I'll go back to see if I can figure out how the routing changes may be affecting things, but I'm kind of a beginner.

jlrdw's avatar

@Max100 did you uncomment this line:

protected $namespace = 'App\\Http\\Controllers';

in boot method add it in:

    public function boot()
    {
        $this->configureRateLimiting();

        $this->routes(function () {
            Route::prefix('api')
                ->middleware('api')
                ->namespace($this->namespace)  <----HERE
                ->group(base_path('routes/api.php'));

            Route::middleware('web')
                ->namespace($this->namespace)
                ->group(base_path('routes/web.php'));
        });
    }

Edit:

This is in RouteServiceProvider.php.

Max100's avatar

@jlrdw Yes, that's the one. It didn't seem to do anything. But it doesn't even seem as if the web.php file is getting called. Maybe it's something with the APP_URL, but I'm not sure. I'll go back to other projects and see if I can see a difference

Snapey's avatar

if you are getting the laragon home page then you don't have .htaccess or your document root is wrong

Max100's avatar

@Snapey That's what I'm getting. I don't see a .httaccess file, but I'll look around. Would it be in the Laravel project folder or in an apache folder?

The document root might explain things. In the apache config file the document root is C:\laragon\www.

But that would apply to the other projects which work fine. The entry in the hosts file appears the same as for the other projects, too. But I can't find where it's finding or calling the standard Laragon start page.

frankielee's avatar
Level 29

@Max100 did you reload the apache after installing the project?

Perhaps show some screenshots will help.

Max100's avatar

@frankielee That was it! I feel really dumb. I don't do this much, so I'm a bit clueless. It turned out that after rebooting the pc (and therefore apache), everything was back to normal.

I think Laragon creates a new virtual host for the new site for apache, but I had to restart apache. before it enabled the site.

Thank you for the suggestion! And thanks to everyone else who answered and offered a lot of good suggestions!

jlrdw's avatar

I tried laragon but decided against it, but an htacces file should be there in public folder.

Have you set public as document root with a virtual host yet?

frankielee's avatar

Hi, @jlrdw

I tried laragon but decided against it

Can I know the reason? I am quite comfortable with it.

jlrdw's avatar

@frankielee I setup nginx and php 8 direct. But also have xampp for dev. I like xampp better.

1 like
Max100's avatar

@jlrdw Thanks for the reply. It turns out that I just needed to restart apache and then the virtual host was enabled and everything worked.

Thanks again

Snapey's avatar

@Max100 to 'see' the .htaccess file you have to list hidden files. All files that start with a period are hidden. ls -a will show the hidden files

Please or to participate in this conversation.