Mautic Community Forums

Absolute url generation is not consistent

I am using Mautic 2.8.2 and facing a strange issue. I have installed mautic in a sub-folder (www.mydomain.com/m) and everything works fine except this issue. The issue is that if I define ‘Site URL’ configuration as www.mydomain.com/m , all links to track emails are generated as they should. but links to form.js has an extra ‘m’ in the url (e.g. www.mydomain.com/m/m/form.js) and therefore my forms do not work. If set the ‘Site URL’ to just the domain name, then forms work but links in the email give a 404 error.



I know it is small issue but have no idea where to fix it.



Please help.

I am using Mautic 2.8.2 and facing a strange issue. I have installed mautic in a sub-folder (www.mydomain.com/m) and everything works fine except this issue. The issue is that if I define ‘Site URL’ configuration as www.mydomain.com/m , all links to track emails are generated as they should. but links to form.js has an extra ‘m’ in the url (e.g. www.mydomain.com/m/m/form.js) and therefore my forms do not work. If set the ‘Site URL’ to just the domain name, then forms work but links in the email give a 404 error.

I know it is small issue but have no idea where to fix it.

Please help.

I fixed the problem by modifying this function from this

public function getBaseUrl() { return $this->siteUrl; }

to this

public function getBaseUrl() { $url = $this->siteUrl; $url_parts = parse_url($url); $real_url = $url_parts['scheme'].'://'.$url_parts['host']; return $real_url;}

Located at …/app/bundles/CoreBundle/Templating/Helper/AssetsHelper.php:139

Console URLs are generated just by appending the siteUrl but asset URLs are generated by guessing the install directory and then pre-prefixing siteUrl to this. I hope Mautic developers will look into that.

It is disappointing that I did not get any response on my post even after 2 days.

Hey there @vijayhrdm, thanks for your post. Community engagement out here on the forums ebbs and flows. We’re currently working on better processes/tools to create more engagement and consistency. As it relates to your situation, if you head over to our Github page and offer your solution up as a fix to an enhancement (Issue submission), or as a fix (Pull Request), I trust you’ll get a better response from the developer community.