Pergunta

I've been having this issue for quite some time. Right now we are using a shared hosting plan and have four domains, one of which points to a symfony project. My goal is simply to omit having the app.php included in the URL. Without any .htaccess applied, all domains work flawlessly and when trying to navigate to the symfony domain I simply get a directory listing instead of having the page render, unless I include the app.php in the URL.

When applying the below htaccess, all non-symfony related domains show a 500 error and the one symfony related domain renders successfully, without the app.php in the URL. My goal at this point is to modify the htaccess so that all non-symfony related domains render successfully as they did before, while still maintaining the below .htacces to omit the app.php from the Symfony related project.

I appreciate any suggestions on how to resolve this issue. Thanks in advance!

.htaccess

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    # Explicitly disable rewriting for front controllers
    RewriteRule ^app.php - [L]

    RewriteCond %{REQUEST_FILENAME} !-f

    # Change below before deploying to production
    RewriteRule ^(.*)$ /app.php [QSA,L]
</IfModule>
Foi útil?

Solução

Replace the line :

RewriteCond %{REQUEST_FILENAME} !-f

With :

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top