Atualmente estou tendo problemas em fazer com que o Apache2 reconheça um arquivo .htaccess
. Atualmente, estou executando o servidor localmente em minha máquina para fins de teste. Posso fazer com que minha página de índice seja carregada sem problemas, mas sempre que navegar para uma página que corresponda a um padrão do arquivo .htaccess
, recebo um erro 404. Aqui está uma amostra dos meus arquivos default.conf
e .htaccess
.
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]
Como você pode ver no default.conf
, eu tenho AllowOverride definido como All, que geralmente é o problema mais comum. Eu tenho os mods corretos do Apache habilitados também. Além disso, também não acredito que seja um problema de permissão. Passei por várias postagens de falha de servidor e estouro de pilha, mas sei que estão disponíveis. Há algo mais que eu poderia estar perdendo? Qualquer ajuda é muito apreciada.
Atualização:
Aqui está um despejo dos meus registros de reescrita:
[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
Nos logs, tudo parece estar funcionando. Quando pego o URL que ele volta ( http://localhost/api/index.php?/v1/i/login
) e coloco no meu navegador, posso prosseguir normalmente. Espero que isso ajude a diagnosticar melhor o meu problema.