My Mautic login URL has always been https://www.domain.com/s/login. I had to reinstall version 2.13 and now my login URL is https://www.domain.com/index.php/s/login
Does any now what could have caused the extra index.php?
My Mautic login URL has always been https://www.domain.com/s/login. I had to reinstall version 2.13 and now my login URL is https://www.domain.com/index.php/s/login
Does any now what could have caused the extra index.php?
Hi Richardmery,
Did you find the solution for this ??
because I am also facing the same issue.
@deepak - sorry for late reply. No, I did not find a solution. I had to go back to version 2.13 from my backup.
Just to say that it happened to me in a fresh installation with http://domain/
as original request. The redirected url was domain://index.php/installer
. It seems to only happen when there is another issue with the installation. After the issue is removed, it also disappears. Yet, I have never seen an explanation for this that points to the code that adds the extra index.php before a path. It’s not even clear if it is added by the server or by Mautic. However, given that it happens as much with nginx as with apache and for many people, independently of their server configuration, it seems to be a feature of Mautic, perhaps of Symfony as well.
as far as i know the default installation for mautic is domain.com/index.php
This can be changed in the Settings → Configurations → System Settings → Site URL,
with the index.php present and some web server configurations it causes issues seeing images and other broken links, you can remove the index.php and then the default becomes /s/login
That has to be a part of the explanation. Currently, in a fresh installation of 5.2, the site url in config/local.php
is https://domain.com
, without the leading /index.php
. But I have seen configurations in which the site url is https://domain.com/index.php
. It is interesting that Mautic accepts both, a leading /index.php
or no leading /index.php
, in the site url. I suspect the issue occurs only when there is a leading /index.php
in the site url. I recall that the issue is not that internally the server rewrite the request to https://domain.com/$request_uri
with a leading /index.php
in $request_uri
. This is of course necessary given that the script entry point is index.php
in the root document. The issue is that we see an index.php
in the url bar before the path as in https://domain.com/index.php/installer
. Mautic does not normally expect that kind of request uri. I guess that it is created in a redirect that adds /installer
after the configured site url, without first removing the extra leading /index.php
.
Part of the explanation is this code of AppKernel, which is executed at installation :
if (false === stripos($request->server->get('SERVER_SOFTWARE', ''), 'apache')
|| !file_exists($this->getProjectDir().'/.htaccess')
&& false === strpos(
$base,
'index'
)
) {
$prefix .= '/index.php';
}
return new RedirectResponse($request->getUriForPath($prefix.'/installer'));
It is flawed. It says that if it isn’t Apache (or if there is no .htaccess file and the base url contains index
) then the prefix is /index.php
. This prefix is added before the path /installer
, but after the base url, in getUriForPath($prefix.'/installer')
So, even if /index.php
occurs in the base url, it will be added again in the redirect url. So, if you initiate the installation with /index.php
in Nginx, unless the configuration has a workaround for this bug, you have a redirect to /index.ph/index.php/installer
and this leads to a 500 internal error.
This is already above my pay grade, but maybe you should drop into and raise an issue in the Mautic github repository
These are the kind of bugs that become features because they’ve been around for so long that some applications might even rely on the behavior created by the bug. Since workarounds exist, the bug is discovered the hard way, a workaround is used, and then it’s forgotten.