# Absolute url generation is not consistent

**URL:** <https://forum.mautic.org/t/absolute-url-generation-is-not-consistent/8923>\
**Category:** Product Support\
**Created:** [July 10, 2017, 6:31am UTC](https://forum.mautic.org/t/absolute-url-generation-is-not-consistent/8923 "2017-07-10T06:31:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijayhrdm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/vijayhrdm/32/1575_2.png) [@vijayhrdm](https://forum.mautic.org/u/vijayhrdm)\
**Post date:** [July 10, 2017, 6:31am UTC](https://forum.mautic.org/t/absolute-url-generation-is-not-consistent/8923/1 "2017-07-10T06:31:05Z")

</div>

I am using Mautic 2.8.2 and facing a strange issue. I have installed mautic in a sub-folder ([www.mydomain.com/m](http://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](http://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](http://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.

---

<div class="post-metadata">

**Author:** ![vijayhrdm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/vijayhrdm/32/1575_2.png) [@vijayhrdm](https://forum.mautic.org/u/vijayhrdm)\
**Post date:** [July 10, 2017, 6:31am UTC](https://forum.mautic.org/t/absolute-url-generation-is-not-consistent/8923/2 "2017-07-10T06:31:05Z")

</div>

I am using Mautic 2.8.2 and facing a strange issue. I have installed mautic in a sub-folder ([www.mydomain.com/m](http://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](http://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](http://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.

---

<div class="post-metadata">

**Author:** ![vijayhrdm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/vijayhrdm/32/1575_2.png) [@vijayhrdm](https://forum.mautic.org/u/vijayhrdm)\
**Post date:** [July 12, 2017, 11:00am UTC](https://forum.mautic.org/t/absolute-url-generation-is-not-consistent/8923/3 "2017-07-12T11:00:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jseevers](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jseevers](https://forum.mautic.org/u/jseevers)\
**Post date:** [July 12, 2017, 8:02pm UTC](https://forum.mautic.org/t/absolute-url-generation-is-not-consistent/8923/4 "2017-07-12T20:02:47Z")

</div>

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](https://github.com/mautic/mautic/issues/new)), or as a fix ([Pull Request](https://github.com/mautic/mautic/pulls)), I trust you’ll get a better response from the developer community.
