Installing Matomo in domain.xyz/s/ instead of sub domain

Hello,
i have a domain where i want to use matomo… my provider still charges me for SSL certificates so i want to install Matomo under domain.xyz/s/ instead of matomo.domain.xyz

Actually it is a bit more complex because i installed Matomo on my webserver under /websites/matomo/ and then i used .htaccess to simulate a directory that is an proxy to the main directory of Matomo (which should be accessable by several domains)

This kind of works but i wonder if this is a nice way…
its not working for the “opt out”-Cookie in my privacy policy because the cookie is set to the path /s instead of just / (EDIT: probably no problem because it only matters to matomo on /s…)

now i wonder how to make everything more stable…

Best

Kilian

as i see, the domain.xyz/s/misc/cron/archive.php?xxx does notwork properly with this configuration…

any possibility to use matomo in a directory instead of a subdomain?

Hi, Kitten!

I would like to help you, but cannot do so until I have determined that your problem is similar to the one that I recently overcame with a simple upgrade of my PHP version.

Please provide the following full URL information:

Where is Matomo currently installed?
Where is the website that Matomo tracks currently installed?
To what new location would you like to install Matomo?

In order to help you with your answer:

domain.xyz is a domain name
domain.xyz/websites/matomo is a directory path that includes the domain name

Roddy

p.s. To the best of my knowledge ( I am not certain about this) a subdomain is little more that a different way to write a director path. In other words, although treated differently matomo.domain.xyz and domain.xyz/matomo are located in the same place – namely, domain.xyz/matomo.

Hi Roddy,

test… does not work… always getting a 500 error when posting a reply. Bad error parsing???

here you can find my reply:
https://pastebin.com/QAH1BxQ2


matomo is installed under
/websites/matomo
This is available under the SSL secured URL https://ssl-provider.xyz/matomo.my.domain.xyz/

But as i dont want to include “third party” scripts from another domain i wanted do just use mod_proxy to simulate a directory under domain.xyz/s

the website to be tracked is installed under
/websites/website
Domain: https://www.domain.xyz

It has a .htaccess that simulates the directory /s

RewriteRule ^s/(.*)$ https://ssl-provider.xyz/matomo.my.domain.xyz/$1 [P]

I changed the JS snipped to match the /s

but it still seems that there are some problems… like mentioned above.

Hi,

Off-Topic, but I could reproduce it. I think the fact that there is an URL to an invlid TLD trips discourse.
Maybe try using .example or example.com for placeholder URLs.

OK. Putting aside your simulated directory for the moment it is now clear that your Matomo and web- applications lie in the same directory path – namely, /websites. Thus communication with the Matomo application using PHP should not be a problem. Now, please allow me to ask what version of PHP you are using?

Roddy

i think the mistake is that i proxy the request over http…

RewriteRule ^s/(.*)$ https://ssl-provider.de/matomo.my.domain.xyz/$1 [P]

All i wanted is to have matomo in one directory on my server for several projects - and not to buy another ssl-certificate… but i think this does not work…

Have you consulted with your Host Server? Mine is very helpful in this regard.

Roddy

Hi,

Maybe I am misunderstanding your use case, but what do you need any kind of RewriteRules for?

Shouldn’t it be enough to drop it into a matomo-folder, setting it up and just using https://yourdomain.example/matomo/ as an Matomo URL?

This shouldn’t need any kind of setup and as long as you don’t have anything in your root .htaccess that contradicts anything Matomo needs, everything should work.

i have given up with this thing…

it is really strange.
i now installed matomo under domain.example/matomo…
in order to not show the name “matomo” in the tracking script i put a redirect in my .htaccess like this:

RewriteRule ^s/(.*)$ matomo/$1 [NC,L,QSA]

but i get loads of js errors in the browser console.

after renaming the directory to /s (and removing the mod_rewrite command) it did not work (JS errors)

i endet up with this weird thing:

RewriteRule ^s/(.*)$ s/$1 [NC,L,QSA]

it redirects vom s/ to s/…

dont know what is happening… but without this line of code in the .htaccess it does not work…

How is it that you want to use Matomo, anyway? If you are only reporting to yourself, then surely you can restrict its use to your own IP address and make it invisible to everyone else.

Roddy

hi roddy,

its not a matter of hiding matomo to other people…

i want to hide the name matomo / piwik from the tracking JS url to prevent adblocker from blocking my tracking script…

but i still wanted the directory to be named “matomo” on my FTP because i still want to have logical names of the directorys in my projects…

it endet up with this weird mod_rewrite command that makes no sense to me…

Hi,

I’m afraid that won’t help that much as if the visitors are using the EasyPrivacy the GET-parameters used by Matomo are blocked.