2

I am running laravel on xampp and I have problem with accessing pages, http://localhost/laravel/public/ I get a login page which is good however when I go for example http://localhost/laravel/public/smokeyard

I get 404 error with The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

Route:

Route::get('smokeyard', 'GuzzleController@smokeyard'); 

Controller:

function smokeyard(){ return view('smokeyard'); } 

All my views are located in resources folder.

4
  • 1. Check apache mod_rewrite is enabled. 2. From cmd go to your project folder. run - php artisan serve command and run your local env on localhost:8000 - your all routes will work 3. use : public/index.php/<your_route>. Commented Jun 5, 2017 at 14:20
  • if you use php artisan serve does it still use mysql module from xampp? Commented Jun 5, 2017 at 14:24
  • Yes mysql and artisan doesn't any connection. Commented Jun 5, 2017 at 14:25
  • The laravel router won't work that way. You need to create a virtual host in which the root would be http://myvhost/ . Then you can access your routes via e.g. http://myvhost/smokeyard Commented Jun 5, 2017 at 14:52

3 Answers 3

5

if you want to access laravel project without running artisan serve, you need to change few settings,

  1. copy the .htaccess file from the public folder and paste it in the root folder of your application

  2. rename the server.php in the root directory to index.php

now go to localhost/your_project_name/smokeyard for the url you want to check

hope this helps

Sign up to request clarification or add additional context in comments.

Comments

1

Run php artisan serve and access your server at http://localhost:8000. Your routes should work fine then.

You can't access your laravel application routes straight away through the folder structure with xampp. You need to setup the web root to point to the public folder and access localhost or run the laravel server and use it. This is because the url rewriting would fail when you access the routes in laravel the way you do.

Comments

0

I tried this in MX Linux 21.xx. My xampp got messed up after installing larvel on it.

  1. check MySQL status with command
mysql service status 
  1. stop the service using the command
service mysql stop 
  1. you will be prompted to provide your password, Enter password.

  2. start xampp using command

sudo /opt/lampp/lampp start 
  1. All should be back to normal

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.