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) ^^
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>
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>
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
Anyone have any suggestions on how to fix this?
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
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
For anyone else that runs into this problem, not having mod_rewrite enabled will also cause this same issue.
small tip. consider using Homestead. it's very easy to set up virtual hosts.
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.
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.
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community