Laravel Quick Start Guide Route Not Working

Laravel quick start guide route not working

Seems like your Laravel app is accesible via an Apache HTTP alias, because your URL looks like: http://localhost/laravel/. If this is the case and assuming that http://localhost/laravel is pointing to your public directory, then follow these steps:

  1. Try to navigate to your expected route prepend it with /index.php/, in your case: http://localhost/laravel/index.php/users. If it works (no 404) then you problem is with the Rewrite Module configuration of Apache HTTP, you should follow the next steps.
  2. Edit the file public/.htaccess.
  3. Under the line RewriteEngine On add RewriteBase /laravel/.
  4. Try to navigate to an existing route.

Basically, if you app resides in a alias or virtual directory (say http://localhost/alias) you should add an entry in your rewrite rule to rewrite the base directory with alias.

Laravel quick start example not run

in the folder you created the project could you run php artisan serve and browse to localhost:8000

Laravel 5.2 quickstart guide gives Not Found Error

When you change your form action parameter to

/learninglaravel/laraquickstart/quickstart/public/task

You are going to make HTTP POST request to

{scheme}://{domain}//learninglaravel/laraquickstart/quickstart/public/task

So laravel is going to look for this route and obviously it won't find it.

Why my laravel routes tutorial is not working?

Try this
.htaccess file

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

RewriteEngine On
#RewriteBase /~projectname/master/

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Also Please try this

Route::get('/about', function () {
return view('pages.about');
});

Route::post('/about', function () {
return view('pages.about');
});

Laravel routing does not work even when my routes exist in route:list and I have tried route:clear and route:cache

You are using same URI route pattern, that's why its conflict with other route. My be its conflict with Route::get('/blog/{short_link}', 'BlogController@show'); or Route::get('/blog/keyword:{keyword}', 'BlogController@filterByKeyword'); because all these routes URL Pattern are same

Laravel project routes not working when app is accessed over the network

The apache virtual host should point to the public directory for your laravel project.

e.g.

<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www/public"
<Directory "${INSTALL_DIR}/www/public">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>


Related Topics



Leave a reply



Submit