403 Forbidden Error & General Query

Hi , I’ve installed the Matomo in the Apache Server using Softaculous Apps Installer.
I have a two domain’s https://Domain1.com where the Matomo is installed ( inside the subdirectory ) & www.Domain2.com where i want to track the visitor’s .
I’ve placed the JS code just before the </head> tag (as mentioned in the docs).

  • The problem is when i visit the www.Domain2.com , in the console.log there is error which shows : Status Code:403 Forbidden .
matomo.php:1 GET http://Domain1.com/subdirectory/matomo.php?action_name=data...&idsite=2&rec=1&r=296216&h=12&m=10&s=54&url=http%3A%2F%2Fwww.Domain2.com%2F&_id=......... 403 (Forbidden)
  • Even if i visit the matomo.php page directly it will show http://Domain1.com/subdirectory/matomo.php
This resource is part of Matomo. Keep full control of your data with the leading free and open source web analytics & conversion optimisation platform.
  • if i visit directly with the parameters http://Domain1.com/subdirectory/matomo.php?action_name=data...&idsite=2&rec=1&r=296216&h=12&m=10&s=54&url=http%3A%2F%2Fwww.Domain2.com%2F&_id=....
    it wil show
Forbidden
You don't have permission to access /subdirectory/matomo.php on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

General Query

  • Is it mandatory to track the domain where the matomo is installed Or
    we can track other domain without tracking the domain its installed on.

Kindly suggest a few steps so that i can solve these issues.

Hi,

It sounds like the .htaccess file of your main site is adding rules that interfere with Matomo (as they are also valid for subdirectories). The easiest solution is to install Matomo in a subdomain as a seperate vhost. That way you can be sure nothing interferes with each other.

Another reason could be that you are using something like mod_security that blocks requests based on rules.

As it is your webserver that is returning the 403, the only definite way to find out is to look in the error logs.

Bump. I am having similar issue. I have installed matomo on a Cloudways PHP hosting server that has nginx, apache, memcached and varnish installed and configure by default. I wanted to install matomo through composer, because it is easy. But couldn’t find composer guide in the docs here: Installing Matomo User Guide - Analytics Platform - Matomo
I download the zip, uploaded and unzipped to the folder. I installed it and then connected the database. However, when I try to access the website by URL, I am getting 500 server error? I think i have done everything as required.

I had same problem, due to a nefferer-policy problem
Check it using https://securityheaders.com/