Anthony
Anthony

Reputation: 5433

.htaccess not running mod-rewrite or not being executed

I have an .htaccess set to permissions 777 with a simple rule:

<IfModule mod_rewrite.c>

    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

In /etc/apache2/apache2.conf, I've deleted all of the commands except a simplified:

<Directory />
  AllowOverride All
</Directory>

In /etc/apache2/sites-enabled/000-default.conf, I've added:

<Directory /var/www/html>
  AllowOverride All
  Options -Indexes +FollowSymLinks +MultiViews
  Order allow,deny
  Allow from all
</Directory>

I've also "sudo service apache2 restart" (Ubuntu 14.04)

But for whatever reason, I can't get calls to http://www.myserver.com/blah/blah to be routed to index.php

It feels like the .htaccess is being ignored or the rewrite rule isn't running.

I'm out of ideas on where to look and I've followed the other SO posts without luck. Any ideas?

Upvotes: 0

Views: 77

Answers (1)

Tebro
Tebro

Reputation: 166

Make sure that you have the rewrite module turned on.

sudo a2enmod rewrite
sudo service apache2 restart

Since you have the if check for the module that means that there wont be any errors if it is not enabled.

Upvotes: 1

Related Questions