How to get rid off 'index.php' in my laravel 5.1 links on Virtual Host -
i'm making link controller's function resides in sub directory of controller directory named 'admin'. when make link in menu bar using following code:
{!! html::link('/admin', 'admin') !!} // www.property.com/admin
it doesn't work, if prefix '/admin' 'index.php/admin' this:
{!! html::link('index.php/admin', 'admin') !!} // www.property.com/index.php/admin
it works fine. problem? how can rid off adding 'index.php' before each of link 'admini'? note i'm using virtual host named 'www.property.com' on ubuntu 15.04. here admincontroller ```
<?php namespace app\http\controllers\admin; use illuminate\http\request; use app\http\requests; use app\http\controllers\controller; class admincontroller extends controller { /** * display listing of resource. * * @return response */ public function index() { return view('admin.index'); } ?>
here route file
route::resource('/', 'homecontroller'); route::resource('/admin', 'admin\admincontroller');
here .htaccess file's code:
<ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes if not 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] </ifmodule>
here virtual host file code:
<virtualhost *:80> serveradmin m.khuramj@live.com servername laravelproperty.com serveralias www.laravelproperty.com documentroot /var/www/property-project/public errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log combined </virtualhost>
if using apache, make sure .htaccess in public folder there.
if not case, create .htaccess in public folder following content:
options +followsymlinks rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l]
if it's still not working, make sure mod_rewrite module in apache enabled :).
Comments
Post a Comment