Questo è il mio .htaccess nella directory public_html:Symfony2: 404 Not Found senza app.php
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/
</IfModule>
</IfModule>
E questo è /etc/apache2/sites-available/mydomain_com.conf:
<VirtualHost *>
ServerAdmin [email protected]
ServerName mydomain.com
ServerAlias www.mydomain.com
# Indexes + Directory Root.
DocumentRoot /home/myuser/domains/mydomain.com/public_html
# DirectoryIndex app.php
<Directory /home/myuser/domains/mydomain.com/public_html>
AllowOverride All
Order allow,deny
Allow from All
</Directory>
# CGI Directory
ScriptAlias /cgi-bin/ /home/myuser/domains/mydomain.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /home/myuser/domains/mydomain.com/log/error.log
CustomLog /home/myuser/domains/mydomain.com/log/access.log combined
</VirtualHost>
e questi sono i risultati:
- mydomain.com => reindirizza a mydomain.com/app.php/ e quindi funziona correttamente.
- mydomain.com/post/ => 404 Not Found
- mydomain.com/app.php/post/ => funziona bene.
Qualche idea?