Answer the question
In order to leave comments, you need to log in
Routing in Symfony2?
The question is this: in Symfony2, the /contact/ and /contact routes are different things. But it would be convenient for me if both options worked, or there was a redirect to the “correct” one.
I know one solution: if you put "/" at the end of the route, like this
contactform:<br>
pattern: /contact/<br>
defaults: { _controller: "WebsiteProjectBundle:Home:contact"}<br>
<IfModule mod_rewrite.c><br>
RewriteEngine On<br><br>
RewriteCond %{HTTPS} =on<br>
RewriteRule ^(.+)/$ https://%{HTTP_HOST}/$1 [R=301,L]<br><br>
RewriteCond %{HTTPS} =off<br>
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] <br><br>
RewriteCond %{REQUEST_FILENAME} !-f<br>
RewriteRule ^(.*)$ app.php [QSA,L]<br>
</IfModule>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question