I am Working on Localhost (WAMP server, php version 5.5.12)
url: http://localhost/laravel/
my root directory .htaccess is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
Public Directory .htaccess is :
<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]
In this scenario when I want to access: http://localhost/laravel/ following error message appears: Sorry, the page you are looking for could not be found.
1/1 NotFoundHttpException in RouteCollection.php line 161:
But when I access : http://localhost/laravel/public/ It successfully loads home page. I have debugged every thing in url rewriting it works fine but laravel not accepting new urls. Can anyone please help me regarding this issue.
php artisan serve
it will save you the stress – Emeka Mbahindex.php
and.htaccess
file from/public
folder to the root. you can get perfect answer from https://stackguides.com/questions/28364496/laravel-5-remove-public-from-url/32519877#32519877 – Miron