Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 2 years ago.
0

Do you see your homepage or all pages are as 404 ?

Last updated 2 years ago.
0

Have you configured your web server appropriately? If not so which one do you use Nginx or Apache

Last updated 2 years ago.
0

Getting the same issue here, everything was running fine, adding new routes as i progressed and now all of a sudden the new routes are not being run. Even putting the route right at the top of the routes file does not run. If you run a:

php artisan routes

the route exists.

Last updated 2 years ago.
0

woogygun said:

Getting the same issue here, everything was running fine, adding new routes as i progressed and now all of a sudden the new routes are not being run. Even putting the route right at the top of the routes file does not run. If you run a:

php artisan routes

the route exists.

Got it sorted with a

php composer.phar update

Last updated 2 years ago.
0

Both woogygun and guiden, think it's useful if you paste the relevant code so we can take a look at it. Use http://bin.laravel.io for that.

To me it sounds like a .htaccess-like problem, or the server not 'pointing' to /public, mod_rewrite not active.

Dayle has some examples for apache, nginx and lighttpd on his Github repo

Last updated 2 years ago.
0

Apache Web on Linux

My answer on stackoverflow: http://stackoverflow.com/a/24354757/2517465

1 Open httpd.conf

    sudo vim /etc/httpd/conf/httpd.conf

2 Make sure the DocumentRoot is pointing to the laravel project's public directory 3 Add the Directory element for that path and Allowoverride All... as follows

DocumentRoot "/var/www/html/laravel/public/"

<Directory "/var/www/html/laravel/public">
Allowoverride All
</Directory>

4 Open .htaccess from ../laravel/public/ and make sure it has the following

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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

5 Restart httpd services

sudo service httpd restart

6 Now http://DomainServer/users will work in your browser.

Last updated 2 years ago.
0

The thing with mine is that the '/' route is working but the others aren't ... why is that?

Last updated 2 years ago.
0

check if rewrite is working

Last updated 2 years ago.
0

how to check that

Last updated 2 years ago.
0

I just ran the command sudo a2enmod rewrite and restarted apache but still no good

Last updated 2 years ago.
0

same problem here, '/' route is working but the others not work ! why ?

Last updated 2 years ago.
0

claratan said:

same problem here, '/' route is working but the others not work ! why ?

Make sure your .htaccess file is copied into your documentroot directory.

Last updated 2 years ago.
0

I was following instruction by @pescadosmith my localhost is perfectly work when I am going to request URL or routes is not exist. the solved is to put add .000-default.conf

<VirtualHost *:80>
	
	
	ServerName www.van-vlymen.com
	ServerAlias van-vlymen.com
	
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html/vanvlymen/public
	
	<Directory /var/www/html/vanvlymen/public>
		Allowoverride All
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	
</VirtualHost>


inside the etc/apache2/000-default.conf.

it seems working now thanks you so much for added this!

Last updated 9 years ago.
0

pescadosmith said:

Apache Web on Linux

My answer on stackoverflow: http://stackoverflow.com/a/24354757/2517465

1 Open httpd.conf

   sudo vim /etc/httpd/conf/httpd.conf

2 Make sure the DocumentRoot is pointing to the laravel project's public directory 3 Add the Directory element for that path and Allowoverride All... as follows

DocumentRoot "/var/www/html/laravel/public/"

<Directory "/var/www/html/laravel/public">
Allowoverride All
</Directory>

4 Open .htaccess from ../laravel/public/ and make sure it has the following

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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

5 Restart httpd services

sudo service httpd restart

6 Now http://DomainServer/users will work in your browser.

This worked for me!

0

pescadosmith said:

Apache Web on Linux

My answer on stackoverflow: http://stackoverflow.com/a/24354757/2517465

1 Open httpd.conf

   sudo vim /etc/httpd/conf/httpd.conf

2 Make sure the DocumentRoot is pointing to the laravel project's public directory 3 Add the Directory element for that path and Allowoverride All... as follows

DocumentRoot "/var/www/html/laravel/public/"

<Directory "/var/www/html/laravel/public">
Allowoverride All
</Directory>

4 Open .htaccess from ../laravel/public/ and make sure it has the following

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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

5 Restart httpd services

sudo service httpd restart

6 Now http://DomainServer/users will work in your browser.

Thanks! This worked for me too.

0

Enable mod_rewrite

sudo a2enmod rewrite
sudo service apache2 restart
0

@johnathansantos

everything else are not working till i do the enable mod_rewrite

sudo a2enmod rewrite
sudo service apache2 restart

finally thank you

Last updated 9 years ago.
0

johnathansantos said:

Enable mod_rewrite

sudo a2enmod rewrite
sudo service apache2 restart

This! solved it for me on a clean install box.

Thanks!

0

Perfect! This worked for me as well. Thank you!

pescadosmith said:

Apache Web on Linux

My answer on stackoverflow: http://stackoverflow.com/a/24354757/2517465

1 Open httpd.conf

   sudo vim /etc/httpd/conf/httpd.conf

2 Make sure the DocumentRoot is pointing to the laravel project's public directory 3 Add the Directory element for that path and Allowoverride All... as follows

DocumentRoot "/var/www/html/laravel/public/"

<Directory "/var/www/html/laravel/public">
Allowoverride All
</Directory>

4 Open .htaccess from ../laravel/public/ and make sure it has the following

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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

5 Restart httpd services

sudo service httpd restart

6 Now http://DomainServer/users will work in your browser.

0

johnathansantos said:

Enable mod_rewrite

sudo a2enmod rewrite
sudo service apache2 restart

much love

0

My routes were working for months and then suddenly I started getting 404 for every route, except the root one

<Directory "/var/www/html/laravel/public">
Allowoverride All
</Directory>

Adding this to apache2.conf solved the problem for me

Last updated 8 years ago.
0

ironheartbj18 said:

@johnathansantos

everything else are not working till i do the enable mod_rewrite

sudo a2enmod rewrite
sudo service apache2 restart

finally thank you

This work for me too

0

did you get this sorted out?

also php mcrypt is required for laravel to work correctly.

if you are using homestead for local development then all that is taken care of.

I also think you should be using Nginx. https://www.digitalocean.com/community/tutorials/apache-vs-nginx-practical-considerations

in my opinion, its way easier to setup and i remember having a lot less problems with it. apache has its strengths, but for the things i currently do i dont see any benefits.

0

johnathansantos said:

Enable mod_rewrite

sudo a2enmod rewrite
sudo service apache2 restart

Spot on! Thanks!

0

lol i dont usually reply but thanks alot

0

2 second check before doing the above, make sure you run

as this rebuilds the static file

0

johnathansantos said:

Enable mod_rewrite

sudo a2enmod rewrite

I too just needed to enable mod rewrite. Thanks!

0

pescadosmith said:

Apache Web on Linux

My answer on stackoverflow: http://stackoverflow.com/a/24354757/2517465

4 Open .htaccess from ../laravel/public/ and make sure it has the following

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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

5 Restart httpd services

sudo service httpd restart

6 Now http://DomainServer/users will work in your browser.>pescadosmith said:

Apache Web on Linux

My answer on stackoverflow: http://stackoverflow.com/a/24354757/2517465

1 Open httpd.conf

   sudo vim /etc/httpd/conf/httpd.conf

2 Make sure the DocumentRoot is pointing to the laravel project's public directory 3 Add the Directory element for that path and Allowoverride All... as follows

DocumentRoot "/var/www/html/laravel/public/"

<Directory "/var/www/html/laravel/public">
Allowoverride All
</Directory>

4 Open .htaccess from ../laravel/public/ and make sure it has the following

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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

And worked for me , thanks

Last updated 8 years ago.
0

johnathansantos said:

Enable mod_rewrite

sudo a2enmod rewrite
sudo service apache2 restart

This saves my day. Thanks @johnathansantos

0

Maybe you created a route with the same uri,

0

Sign in to participate in this thread!

Eventy

Your banner here too?

guidsen guidsen Joined 24 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.