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

shakti's avatar

Problem in route

Hello guys

I have a strange problem with route

// show quiz start page
Route::get('/quiz', 'QuizController@index');
// step one
Route::get('/quiz/stepone', 'QuizController@stepone');

Whenever i try to call localhost/site/quiz it redirect me to localhost/quiz but on server its working fine can anyone help me in this

0 likes
12 replies
RayC's avatar

What server are you running locally?

It appears that your base localhost is pointing to directory site which would be why the route is sending you to localhost/quiz

You need to point localhost to the directory above site locally.

shakti's avatar

right now i m using xampp. except this url all the url are working fine on local server. the route of mine is about 1000 line so you can imagine how many url are there all are working fine except this url.

In the above case localhost/site/quiz it redirect me to localhost/quiz but localhost/site/quiz/stepone working fine

ankitparmar372's avatar

Please run your site on port in local . Go to your laravel directory than type below command. "php artisan serve" It's echo url like http://localhost:8000 Than check your route issue. May be it solved.

shakti's avatar

@ankitparmar372 As i told you its working on all the url except the above which i have mention.

I have already tried to call php artisan serve but it no use

RayC's avatar

Maybe you have a clash with another Route for this one. I am assuming these routes are in a group with a prefix?

Can you post your routes file or at least the group?

somnathsah's avatar

You can run the below command and verify if correct route is being created.

php artisan route:list

And also check no duplicate route has been created and you don't have any redirect call for the route localhost/quiz in method for route localhost/site/quiz

shakti's avatar

@ankitparmar372 See bro its working on server so to show client its totally fine but on our local system its giving problem

for now we dont focus on it as from client view everything is fine but i was just double checking in near future it might not create problem

anyway thanks for that

2 likes
deepak4585's avatar

Route::get('/quiz', 'QuizController@index')->name('quizhome');

and call this from your view url as {{'quizhome'}}

deepak4585's avatar

Look its just a name [localhost/site/quiz] for url

Please or to participate in this conversation.