mardi 28 avril 2015

URL Rewriting and Laravel 4 Routes not working on server?

I bet this question has been asked time and time again, but I just can't seem to get an answer. Anyway, here is my situation. I have a domain, lets say example.com. Example.com works fine, everything works as it should. However, if I navigate to Example.com/about, which works on my local machine, I get a 404 error. However, if I go to http://ift.tt/TUkjiV, the about page works fine. I know this must be a mod rewrite issue. I have enabled mod rewrite and restarted my server to no avail. Anyway, here is some code:

Virtual Host:

<VirtualHost *:80>
  ServerName example.com
  DocumentRoot "/var/www/example/public"
  <Directory "/var/www/example/public">
    AllowOverride all
    Allow from All
  </Directory>
</VirtualHost>

And here is my .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 a Digital Ocean Droplet.

Thanks!

Aucun commentaire:

Enregistrer un commentaire