php - Laravel called from ROOT outsite the /public folder. Getting NotFoundHttpException -
php - Laravel called from ROOT outsite the /public folder. Getting NotFoundHttpException -
i've searched through web solve problem non of solutions works me there, after couple of hours of struggling routing module i've decided inquire helping hand.
problem
i unable access laravel application outside /public directory. need type localhost\projects\laravel\public in browser want utilize url withour /public. main reason because utilize shared hosting , have no access apache configuration file i'm unable create vhost.
background
i've installed manually laravel framework under the: **c:\xampp\htdocs\projects\laravel** , used composer rest me.
the routing has been set to: route::get('/', 'homecontroller@showwelcome');
in project root directory **c:\xampp\htdocs\projects\laravel** i've set .htacces file next content:
<ifmodule mod_rewrite.c> rewriteengine on rewritebase /projects/laravel/ rewriterule ^(.*)$ public/$1 [l] </ifmodule> <ifmodule !mod_rewrite.c> errordocument 404 /index.php </ifmodule>
in application root dir c:\xampp\htdocs\projects\laravel\public have .htaccess next code in it:
<ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front end controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule>
when type: localhost\projects\laravel\ i've got notfoundhttpexception
when type: localhost\projects\laravel\public i've got welcome page
any help appreciate, thanks.
if want without public on uri, using composer laravel root. utilize command php artisan serve , browse localhost:8000 browser. bring homepage.
php .htaccess laravel-4 routing
Comments
Post a Comment