Laravel 5 needs index.php using Apache virtual host -
when load pages not root, page won't load without index.php before route. error get:
not found requested url /login not found on server. apache/2.4.7 (ubuntu) server @ mydomain.com port 80
to start have virtual host file containing:
//also tried adding directoryindex here before <directory> <directory /var/www/mydomain.com> directoryindex index.php allowoverride </directory>
and .htacces in public :
<ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule>
i have domain same .htaccess , appache config on same server , works fine. did restart apache. if use phpinfo on index.php/route page see @ loaded modules:
mod_rewrite mod_setenvif
when running website localy xampp works fine. hours i'm trying can't fix or find error (logs empty) or solutions haven't tried yet.
edit:
im using ubuntu ubuntu 14.04 x64 on digital ocean vps. , tried turning on , off again (as suggested). php version 5.5.9-1ubuntu4.9. followed this tutorial config (except direcoty part). changed location of apache log , file error.log created on given directory no errors in it.
my appache config : (i've triple checked white parts domain name is).
when run apache2ctl -t d dump_vhosts
this looks fine me, tried disabling default config didnt help.
note: i've replaced real domain mydomain.com in reality use real domain on these spots.
thought how know sure conf file im editing 1 being used domain?
this correct alternative htaccess rule laravel 5 suggested use when default doesn't work:
options +followsymlinks rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l]
the options +followsymlinks
believe plays important role because directotyindex
acts symlink.
also check /app/config/app.php make sure haven't set config('app.url') contain index.php.
if have laravel installed in sub-directory see this: how can remove "public/index.php" in url generated laravel?
Comments
Post a Comment