"analytics" subfolder which does not exist

I decided to install Piwik manually.

  1. subdomain and mysql db was created.

  2. cd to subdomain folder and ran: wget https://builds.piwik.org/piwik.zip && unzip piwik.zip

  3. supposed to be able to access the installation URL but keep getting “Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.”

  4. Error logs indicates:
    [Sun Apr 09 00:27:14.549203 2017] [autoindex:error] [pid 4641:tid 140376081909504] [client 52.15.200.154:43770] AH01276: Cannot serve directory /home/$username/public_html/analytics/: No matching DirectoryIndex (index.php,index.php5,index.php4,index.php3,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.phtml,index.shtml,index.xhtml,index.html,index.htm,index.wml,Default.html,Default.htm,default.html,default.htm,home.html,home.htm) found, and server-generated directory index forbidden by Options directive

Tried to install using automated installation:

  1. Installed successfully:
    Piwik has been successfully installed a:

https://analytics.$website.com
Administrative URL : https://analytics.$website.com/index.php

But each of these URL triggers the same 404.

After digging around, this is what I think is happening but know that you can figure it out more easily:

Something within the scripting is redirecting the URL to https://analytics.$website.com/analytics which on the server-side would be: /home/$username/public_html/analytics/analytics

which doesn’t exist.

You can see the URL redirect by using curl:

curl https://analytics.$website.com/index.php -vvv
* About to connect() to analytics.$website.com port 443 (#0)
* Trying 123.456.786.87...
* Connected to analytics.$website.com (123.456.786.87) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_************
* Server certificate:
* subject: CN=www.analytics.$website.com
* start date: Apr 07 08:33:00 2017 GMT
* expire date: Jul 06 08:33:00 2017 GMT
* common name: www.analytics.$website.com
* issuer: CN=CA Authority X3,O=CA,C=US
> GET /index.php HTTP/1.1
> User-Agent: curl/7.29.0
> Host: analytics.$website.com
> Accept: /
> 
< HTTP/1.1 301 Moved Permanently <===
< Date: Sun, 09 Apr 2017 06:17:07 GMT
< Server: Apache
< Location: https://analytics.$website.com/analytics/ <===
< Content-Length: 257
< Content-Type: text/html; charset=iso-8859-1
< 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title> <===
</head><body>
<h1>Moved Permanently</h1> <===
<p>The document has moved <a href="https://analytics.$website.com/analytics/">here</a>.</p> <===
</body></html>
* Connection #0 to host analytics.$website.com left intact

As far I can tell, this is not Apache doing this but something within the scripting itself, perhaps a setting in the configuration that asks where the software is installed or relative paths, etc.

To prove Apache is not causing this, but only once the PHP is loaded by the index.php file, I have directly brought up one of the non-PHP files in the directory, such as the “LEGALNOTICE” file:

# ls -lsa /home/$username/public_html/analytics/LEGALNOTICE 
8 -rw-r--r-- 1 $username $username 7826 Apr 4 14:11 LEGALNOTICE

https://analytics.$website.com/LEGALNOTICE

Where can I find the settings in the script that is attempting to bring up the “analytics” subfolder which does not exist?

And please can you figure out why this is happening?