diff --git a/public/.htaccess b/public/.htaccess
index 48960e7c94170d5f9612714d8d924562a52f6452..ac9484a44d2ee674b5162359e651175694068675 100644
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -1,4 +1,4 @@
-ErrorDocument 404 /404.html
+ErrorDocument 404 /404.php
 
 <FilesMatch "\.(sql)$">
     Order Deny,Allow
diff --git a/public/404.html b/public/404.php
similarity index 86%
rename from public/404.html
rename to public/404.php
index b93d1d86c06d66aca93c5fa3e75c2b8d898c50f8..332ebda03cf792ca75b92c04b64fcea955d16e2d 100644
--- a/public/404.html
+++ b/public/404.php
@@ -1,3 +1,13 @@
+<?php
+include "internal/config.php";
+
+if (strpos($_SERVER['HTTP_HOST'], '.onion') !== false) {
+    $trackURL = $trackURLTor;
+} else {
+    $trackURL = $trackURLNormal;
+}
+?>
+
 <!DOCTYPE html>
 <html lang="en">
 <head>
@@ -9,7 +19,7 @@
 </head>
 <body>
 <!-- Matomo Image Tracker-->
-<img src="https://matomo.jonasled.de/matomo.php?idsite=1&amp;rec=1" style="border:0" alt="" />
+<img src="<?php echo($trackURL); ?>" style="border:0" alt="" />
 <!-- End Matomo -->
 <div id="particles-js"></div>
 <div class="terminal-window">