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

So, in Laravel you must assign every route. This's very different from previous frameworks (like CI). In case of you, just:

Route::get('user', 'PagesController@userPage');

In routes.php

PagesController is class controller and userPage is method of PagesController class. Make sure it's loaded.

Sr my english (very bad) ^^

Last updated 2 years ago.
0

Thanks anhsaker, that does help a bit, but not the main issue.

I've been digging through more, and I found that I can get to those other routes: Route::get('user', 'PagesControllers@userPage'); but only if I add the index.php before it. So, the URL would look like example.com/index.php/user.

Just to first clarify, yes mod_rewrite is enabled. Here is my htaccess

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

    RewriteEngine On
    RewriteBase /

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

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

Just out of curiosity , in your Apache httpd.conf. Do you have this line setup? Where index.php is set?

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

Last updated 2 years ago.
0

awsp, I have a line similar to that,

DirectoryIndex index.html index.html.var

I added the index.php, restarted my server, but it's still not working. Should I add the syntax that you have, being the IfModule... statment?

awsp said:

Just out of curiosity , in your Apache httpd.conf. Do you have this line setup? Where index.php is set?

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#

   DirectoryIndex index.html index.php


Last updated 2 years ago.
0

Any help would be greatly appreciated.

Last updated 2 years ago.
0

Anyone have any suggestions on how to fix this?

Last updated 2 years ago.
0

I had the same issue, after a lot of search I found it was a typo in my .conf file (the <Directory /var/www/mywebsite/public>) contained a typo and I overlooked it for a dozen times, eventually with copy and paste I saw the typo

Last updated 2 years ago.
0

Not shure, but i think you need to set AllowOverrides. I had the same problem using a virtual host, where i forgot to set AllowOverride All in the directory directive. To check if your htaccess file is really being triggert put a redirect right behind

<IfModule mod_rewrite.c>
Redirect 301 / https://google.com
...

If google does not show up in your browser, your htaccess file is not being triggert. So in your httpd.conf change

<Directory />
AllowOverride None
</Directory>

this to

<Directory />
AllowOverride All
</Directory>

hope that'll help you.

Last updated 2 years ago.
0

Thanks DavidDomain!!!!! This solved my problem

Last updated 2 years ago.
0

For anyone else that runs into this problem, not having mod_rewrite enabled will also cause this same issue.

0

small tip. consider using Homestead. it's very easy to set up virtual hosts.

0

Yea this is pretty much a rewrite issue. Its not enough to enable mod_rewrite on Apache. The AllowOverride in the config has to be set appropriately most of the time.

0

DavidDomain said:

Not shure, but i think you need to set AllowOverrides. I had the same problem using a virtual host, where i forgot to set AllowOverride All in the directory directive. To check if your htaccess file is really being triggert put a redirect right behind

<IfModule mod_rewrite.c> Redirect 301 / https://google.com ...

If google does not show up in your browser, your htaccess file is not being triggert. So in your httpd.conf change

<Directory /> AllowOverride None </Directory>

this to

<Directory /> AllowOverride All </Directory>

hope that'll help you.

Thanks DavidDomain!!!!! This solved my problem.

0

In windows i thing file permission problem when you install laravel thorough command it give premission to all file i dont know what its is but to solve problem you might guess copy all files of laravel and paste it in new folder if problem solve then pisout.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

lucasatace lucasatace Joined 13 Feb 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.