Here's is My Laravel-5.4 code that i am facing problem. I had created test laravel project with two pages home & about us and mapped the file path using Apache v-host(www.test.com)
When i hit www.test.com it loads correctly to the index page but when i try to hit www.test.com/about It showing 404 error .But when i hit like this url www.test.com/index.php/about page loads properly
I don't know its problem is in my code or Apache configuration or any other
controller:
public function index(){
return view('pages.index');
}
public function about(){
return view('pages.about');
}
Route :
// Home Page
Route::get('/','pagesController@index');
// About Us Page
Route::get('/about','pagesController@about');
Apache conf:
ServerAdmin webmaster@localhost
ServerName test.com
ServerAlias www.test.com
DocumentRoot /var/www/html/test/public/
.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# 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>