Hi Guys,
I’m trying to set up a librenms which will run under the sub directory. But whatever I do, login page is always being redirected to /login rather than /librenms/login. What could be the issue here?
My config.php is:
<?php
$config["base_url"]="/librenms/";
And .env is:
APP_KEY=base64:GdGyzZ3odxOPV33rR+lOGZlcvIqkZFlubrCqTtC0QAs=
DB_HOST=localhost
DB_DATABASE=librenms
DB_USERNAME=xxxxxx
DB_PASSWORD=xxxxxxxx
#APP_URL=
NODE_ID=5f917f1fa6d25
APP_URL=/librenms/
Have you written a redirect in the apache/nginx config?
https://docs.librenms.org/Extensions/Sub-Directory/
Thanks, my nginx config was the culprit and when I switched to apache and applied the config redirection worked. However after the login I always get a 404 unless I add a /index.php or /devices to the URL. Something is wrong with the .htaccess I suppose (I only changed the RewriteBase).
Nice to hear it worked partially.
With the index.php there .ist be something wrong with the RewriteRule.
Recheck your .htaccess
I think there is something wrong with the documentation, see my git diff
diff --git a/html/.htaccess b/html/.htaccess
index 608a095d8..2e5bc5d4a 100644
--- a/html/.htaccess
+++ b/html/.htaccess
@@ -20,7 +20,7 @@ AddType image/svg+xml .svg
</IfModule>
RewriteEngine on
-RewriteBase /
+RewriteBase /librenms
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(js|ico|txt|gif|jpg|png|css|php)
What I’ve realized is, when I request https://mydomain/librenms/ Apache rewrites the request as https://mydomain/librenms/index.php However only if I call https://mydomain/librenms/index.php?/ I can browse the homepage.
Btw, it doesn’t matter if I add a trailing slash or not to the rewritebase directive.