Skip to content
Advertisement

Symfony too many redirect on apache server

Despite I’ve searched on the web I didn’t found the answer yet.

I made a simple Symfony project working fine on dev ENV with Symfony server.

I decided to put it on apache server to preview it before some live test but I’ve been facing some issues.

I made a blog part that display nicely without post in it but if I add one (or more) post I have an error on too many redirects. The dev tool says I have a lot of request like this: – blog – blog/ – blog – blog/ – … And crashes.

I used the symfony/apache-pack that gave me the .htaccess:

JavaScript

I use the apache site config following:

JavaScript

(Some parts has been changed/removed like path or domain name)

My blog controller looks like this:

JavaScript

Strange fact: When I change the route to “blog/list” by example it works fine Back to “blog” error again.

I don’t understand has some static page are routed as “main” with subpage “main/sub” handled like the blog but without database interaction.

Anyone had the problem?

Advertisement

Answer

Don’t use the rewrite pack,

follow the manual https://symfony.com/doc/current/setup/web_server_configuration.html#apache-with-mod-php-php-cgi

section ‘Apache with mod_php/PHP-CGI’, the config example with the allowOverride none.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement