0

I have developed whole working project in Laravel and finally to give someone else to use it, i have to remove command php artisan serve to run the project. I just want the user to type localhost/projectname and start to use the project on localhost. Hence i followed this link - how-to-run-laravel-without-artisan.

But now only this link is working properly -

localhost/projectname

And all these links given below throws error :

localhost/product_list
localhost/client_list

OUTPUT :

Error Image

But if i type these, it works :

localhost/projectname/product_list
localhost/projectname/client_list

I tried to change base_url (APP_URL) so that whatever is been applied in url should be in suffix of APP_URL

//.env file
APP_URL=http://localhost/projectname

//app.php
'url' => env('APP_URL', 'http://localhost/projectname'),

Then too all routes(product_list) gets attached to localhost/product_list and not localhost/projectname/product_list

I want to make it work like this => localhost/projectname/product_list

OR

May be some other solution.

  • Did you follow the instructions from the accepted answer or other answers? – shaedrich Jun 25 '21 at 11:35
  • @shaedrich followed it well – user15360495 Jun 25 '21 at 11:36
  • @shaedrich followed the accepted answer, but stuck in this situation. I dont know why BASE_URL (APP_URL) is not changing. – user15360495 Jun 25 '21 at 11:50
  • Maybe this is the easier solution: https://stackoverflow.com/a/54251427/7451109 – shaedrich Jun 25 '21 at 11:53
  • @shaedrich I have reverted/Undo all changes back and got back to my original project. And now followed your given link. But how should i run my project now ? With **php artisan serve** or directly **localhost/projectname**. Because localhost/projectname says **404|Not found** and when i run **127.0.0.1:8000** it require php artisan serve – user15360495 Jun 25 '21 at 12:01
  • `localhost/product_list` with an apache or nginx server running locally – shaedrich Jun 25 '21 at 12:03
  • @shaedrich I am using apache (Xampp). And also i just checked that its working without php artisan serve but like this **localhost/projectname/public/product_list**. I want it like this : **localhost/projectname/product_list**. What should i do ? – user15360495 Jun 25 '21 at 12:07
  • If you configure your apache/.htaccess properly according to the answer I posted, it points to `public/` folder so you don't have to include `/public/` into your URL. Have you done that? – shaedrich Jun 25 '21 at 12:09
  • @shaedrich You are right but when i type : **localhost/projectname** its shows **404|Not Found**. And even after manually entering **localhost/projectname/public** homepage works, but other links on hover shows url pointing like this : **localhost/product_list** and not **localhost/projectname/public/product_list** – user15360495 Jun 25 '21 at 12:13
  • @shaedrich I have once again reverted all changes, all started fresh. This time I noticed that even without adding **.htaccess** in root folder, Manually typing **localhost/ims/public** works, but only for homepage, not for other links. I have to make it work with **php artisan serve**, which i dont want. – user15360495 Jun 25 '21 at 13:27

0 Answers0