I have been trying to get my .htaccess
file to work on my localhost. I know that the file works because it is on my server and works. However it doesn't seem to be working locally.
I have followed the tutorials I could find to set overrides to all, below is my /etc/apache2/sites-available/default
file start:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
This is the code in the same directory for my nibble site:
<VirtualHost *:80>
ServerName nibble.local
DocumentRoot /var/www/nibble_framework/web/
<Directory /var/www/nibble_framework/web/>
AllowOverride All
Options Indexes FollowSymLinks MultiViews
Allow from All
</Directory>
RewriteLog /var/www/rewrite.log
ErrorLog /var/log/apache2/error.log
</VirtualHost>
I have enabled this site using a2ensite and restarted apache. I have also added the site to my hosts file:
127.0.0.1 nibble.local
I have enabled mod rewrite using a2enmod and restarted/reloaded apache multiple times.
$ a2enmod rewrite
Module rewrite already enabled
My .htaccess
file is in /var/www/nibble_framework/web/.htaccess
and has the following code:
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/?.*$ - [E=FILE:%{DOCUMENT_ROOT}/$1.php]
RewriteCond %{ENV:FILE} !^$
RewriteCond %{ENV:FILE} -f
RewriteRule ^([^/]*)/?(.*)$ $1.php?url=$2 [QSA,L]
RewriteCond %{ENV:FILE} !^$
RewriteCond %{ENV:FILE} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
When I do a print_r($_REQUEST)
, it is allways an empty array even when the url is poplulated by a long string.
Does anyone have any idea why this might be failing?
Edit:
apache2 access log:
~$ tail -f /var/log/apache2/access.log
::1 - - [16/Aug/2011:07:32:39 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"
::1 - - [16/Aug/2011:07:32:39 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"
::1 - - [16/Aug/2011:07:32:39 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"
::1 - - [16/Aug/2011:07:32:40 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"
::1 - - [16/Aug/2011:07:32:40 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"
::1 - - [16/Aug/2011:07:32:40 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"
::1 - - [16/Aug/2011:07:32:40 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"
::1 - - [16/Aug/2011:07:32:40 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"
::1 - - [16/Aug/2011:07:32:40 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"
::1 - - [16/Aug/2011:07:32:40 +0100] "OPTIONS * HTTP/1.0" 200 152 "-" "Apache/2.2.16 (Ubuntu) (internal dummy connection)"