apache - Symfony2 : 404 Not Found without app.php -
this htaccess in public_html directory :
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>
and /etc/apache2/sites-available/mydomain_com.conf :
<virtualhost *> serveradmin webmaster@mydomain.com 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 order allow,deny allow </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>
and these results :
- mydomain.com => redirects mydomain.com/app.php/ , works fine.
- mydomain.com/post/ => 404 not found
- mydomain.com/app.php/post/ => works fine.
any idea ?
is mod_rewrite of apache enabled? if not, enable it, restart server , try again.
a2enmod rewrite service apache2 restart
Comments
Post a Comment