Reputation: 647
I'm not sure if Sonata has something to do with this or if its related to PHP-FPM, but on production, when following app.php, internal redirects are not followed. If I visit /profile and the link is /profile/, I am taken to the page that asks me to click on /profile/. After a lot of Googling and reading the Book, I'm not sure where to turn.
Here is my VirtualHost:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com mysite.com
DocumentRoot /var/www/mysite/web
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<FilesMatch \.php$>
SetHandler proxy:fcgi://127.0.0.1:9000
</FilesMatch>
<Directory /var/www/mysite/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
Inside web directory I have an .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
I've hit the website at mysite.com/profile and mysite.com/app.php/profile and still get the same issue.
Thanks!
Upvotes: 0
Views: 239
Reputation: 586
We checked with Eugene and here is 2 possible solutions
So first let's check why it happens
It happens coz in sonata bundle we have event listener for redirect like that
// display a validation page before redirecting, so the editor can edit the current page
if ($page && $response->isRedirection() && $this->cmsSelector->isEditor() && !$request->get('_sonata_page_skip')) {
$response = new Response($this->templating->render('SonataPageBundle:Page:redirect.html.twig', array(
'response' => $response,
'page' => $page,
)));
$response->setPrivate();
$event->setResponse($response);
return;
}
and as you can get from this we can do one of two possible solutions
_sonata_page_skip=true
response|raw
Upvotes: 1