php - URL Rewriting and Laravel 4 Routes not working on server? -


i bet question has been asked time , time again, can't seem answer. anyway, here situation. have domain, lets example.com. example.com works fine, works should. however, if navigate example.com/about, works on local machine, 404 error. however, if go example.com/index.php/about, page works fine. know must mod rewrite issue. have enabled mod rewrite , restarted server no avail. anyway, here code:

virtual host:

<virtualhost *:80>   servername example.com   documentroot "/var/www/example/public"   <directory "/var/www/example/public">     allowoverride     allow   </directory> </virtualhost> 

and here .htaccess

<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'm using ubuntu 14.04 on digital ocean droplet.

thanks!

1) go /etc/apache2/sites-available , create file , add below

<virtualhost *:80>     servername example.com     serveradmin webmaster@newyear     documentroot /var/www/html/example/public     <directory /var/www/html/example/public>         options indexes followsymlinks         allowoverride         require granted     </directory> </virtualhost> 

2) create link of above created file , paste /etc/apache2/sites-enabled

3) check /etc/apache2/mods-available rewrite.load file if not there create , add below line & save

loadmodule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so 

create link of rewrite.load file , paste etc/apache2/mods-enabled

4) open /etc/hosts add below

127.0.0.1    example.com 

5) sudo service apache2 restart


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -