I'm currently having issues with getting Apache2 to recognize an .htaccess
file. I'm currently running the server locally on my machine for testing purposes. I can get my index page to load up without issue but anytime I would navigate to a page that matches a pattern from the .htaccess
file, I get a 404 error. Here is a sample of both my default.conf
file and .htaccess
file.
default.conf
NameVirtualHost *
<VirtualHost *>
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
Require all granted
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
.htaccess
# Prevent Directoy listing
Options -Indexes +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index\.php/? [NC]
RewriteCond %{REQUEST_URI} ^/([^/]+)/?.*/? [NC]
RewriteRule ^(.*) /api/index.php?/$1 [QSA,P,L]
As you can see from the default.conf
I have AllowOverride set to All, which is usually the most common problem. I have the correct Apache mods enabled as well. Also, I don't believe it to be a permissions issues either. I've gone over a multitude of Server Fault and Stack Overflow posts but to know avail. Is there something else I could be missing? Any help is greatly appreciated.
Update: Here is a dump of my rewrite logs:
[Sun Mar 09 00:07:45.752577 2014] [rewrite:trace3] [pid 10168] mod_rewrite.c(468): [client 127.0.0.1:37380] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b663e058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] add path info postfix: /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/v1 -> /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/v1/i/login, referer: http://localhost/login.php
[Sun Mar 09 00:07:45.752608 2014] [rewrite:trace3] [pid 10168] mod_rewrite.c(468): [client 127.0.0.1:37380] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b663e058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] strip per-dir prefix: /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/v1/i/login -> v1/i/login, referer: http://localhost/login.php
[Sun Mar 09 00:07:45.752614 2014] [rewrite:trace3] [pid 10168] mod_rewrite.c(468): [client 127.0.0.1:37380] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b663e058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] applying pattern '^(.*)' to uri 'v1/i/login', referer: http://localhost/login.php
[Sun Mar 09 00:07:45.752630 2014] [rewrite:trace2] [pid 10168] mod_rewrite.c(468): [client 127.0.0.1:37380] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b663e058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] rewrite 'v1/i/login' -> '/api/index.php?/v1/i/login', referer: http://localhost/login.php
[Sun Mar 09 00:07:45.752636 2014] [rewrite:trace3] [pid 10168] mod_rewrite.c(468): [client 127.0.0.1:37380] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b663e058/initial] split uri=/api/index.php?/v1/i/login -> uri=/api/index.php, args=/v1/i/login, referer: http://localhost/login.php
[Sun Mar 09 00:07:45.752641 2014] [rewrite:trace2] [pid 10168] mod_rewrite.c(468): [client 127.0.0.1:37380] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b663e058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] escaped URI in per-dir context for proxy, /api/index.php -> /api/index.php, referer: http://localhost/login.php
[Sun Mar 09 00:07:45.752648 2014] [rewrite:trace2] [pid 10168] mod_rewrite.c(468): [client 127.0.0.1:37380] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b663e058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] forcing proxy-throughput with http://localhost/api/index.php, referer: http://localhost/login.php
[Sun Mar 09 00:07:45.752653 2014] [rewrite:trace1] [pid 10168] mod_rewrite.c(468): [client 127.0.0.1:37380] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b663e058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] go-ahead with proxy request proxy:http://localhost/api/index.php?/v1/i/login [OK], referer: http://localhost/login.php
[Sun Mar 09 00:08:08.009404 2014] [rewrite:trace3] [pid 10158] mod_rewrite.c(468): [client 127.0.0.1:37389] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b6640058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] strip per-dir prefix: /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/index.php -> index.php
[Sun Mar 09 00:08:08.009460 2014] [rewrite:trace3] [pid 10158] mod_rewrite.c(468): [client 127.0.0.1:37389] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b6640058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] applying pattern '^(.*)' to uri 'index.php'
[Sun Mar 09 00:08:08.009473 2014] [rewrite:trace1] [pid 10158] mod_rewrite.c(468): [client 127.0.0.1:37389] 127.0.0.1 - - [localhost/sid#b63dbc90][rid#b6640058/initial] [perdir /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/] pass through /media/lnendza/Storage/workspace/CheckMate/Heffalump/site/api/index.php
From the logs, everything looks like it should be working. When I take the URL it spits back (http://localhost/api/index.php?/v1/i/login
) and put that into my browser, I can proceed as normal. I hope this helps further diagnose my issue.