Redirect to /login leads to Not Found #1265

Closed
opened 2026-02-05 00:26:27 +03:00 by OVERLORD · 15 comments
Owner

Originally created by @Fuuzz on GitHub (Jul 17, 2019).

Hello, just installed the app on my Centos 7 VPS as explained on https://www.bookstackapp.com/docs/admin/installation/.
Installation seems completed successfully, but when reaching the website it redirects to domain.com/login, and shows a "Not Found" error page.
A phpinfo.php file in the /public folder is opened correctly, so DNS resolution and DocumentRoot setting are fine.
The mod_rewrite module is enabled, /storage folder has apache as user.
No /login folder in the /public folder.
Ask me, and I'll provide any other necessary information for troubleshooting.
Thank you in advance :)

Originally created by @Fuuzz on GitHub (Jul 17, 2019). Hello, just installed the app on my Centos 7 VPS as explained on https://www.bookstackapp.com/docs/admin/installation/. Installation seems completed successfully, but when reaching the website it redirects to domain.com/login, and shows a "Not Found" error page. A phpinfo.php file in the /public folder is opened correctly, so DNS resolution and DocumentRoot setting are fine. The mod_rewrite module is enabled, /storage folder has apache as user. No /login folder in the /public folder. Ask me, and I'll provide any other necessary information for troubleshooting. Thank you in advance :)
OVERLORD added the 🐕 Support label 2026-02-05 00:26:27 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jul 18, 2019):

Hi @Fuuzz,
Sorry to hear you are having issues.

So I assume you're using Apache?
Have you added BookStack as it's own virtualhost in Apache?
If so are the re-write rules in the virtualhost block or are you instead using the rewrite rules .htaccess file?

If using the .htaccess file, have you done anything to enable use of these? (I think they are disabled by default on many systems for security).

@ssddanbrown commented on GitHub (Jul 18, 2019): Hi @Fuuzz, Sorry to hear you are having issues. So I assume you're using Apache? Have you added BookStack as it's own virtualhost in Apache? If so are the re-write rules in the virtualhost block or are you instead using the rewrite rules .htaccess file? If using the .htaccess file, have you done anything to enable use of these? (I think they are disabled by default on many systems for security).
Author
Owner

@Fuuzz commented on GitHub (Jul 18, 2019):

Hello @ssddanbrown, thank you for the reply.
Yes, i forgot to specify I'm using Apache.
Just to understand, what do you mean with the virtualhost for Bookstack?
I tried both using and removing the .htaccess file in the /public folder, and while i verified that the .htaccess file is indeed working, there is no difference whether the .htaccess file is present in the public folder or not.
To be sure, there should be a /login folder inside /public, or it's a redirection? Because i actually see no /login folder in /public.
Thank you in advance :)

@Fuuzz commented on GitHub (Jul 18, 2019): Hello @ssddanbrown, thank you for the reply. Yes, i forgot to specify I'm using Apache. Just to understand, what do you mean with the virtualhost for Bookstack? I tried both using and removing the .htaccess file in the /public folder, and while i verified that the .htaccess file is indeed working, there is no difference whether the .htaccess file is present in the public folder or not. To be sure, there should be a /login folder inside /public, or it's a redirection? Because i actually see no /login folder in /public. Thank you in advance :)
Author
Owner

@ssddanbrown commented on GitHub (Jul 18, 2019):

There's no /login folder, All requests are routed through public/index.php which is what the redirects enable.

In regards to a VirtualHost, With apache you'd often define a virtualhost block in the apache config files, something like this:

<VirtualHost *:80>
	ServerName my.domain.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/bookstack/public/

    <Directory /var/www/bookstack/public/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
        <IfModule mod_rewrite.c>
            <IfModule mod_negotiation.c>
                Options -MultiViews -Indexes
            </IfModule>

            RewriteEngine On

            # Handle Authorization Header
            RewriteCond %{HTTP:Authorization} .
            RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

            # Redirect Trailing Slashes If Not A Folder...
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_URI} (.+)/$
            RewriteRule ^ %1 [L,R=301]

            # Handle Front Controller...
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^ index.php [L]
        </IfModule>
    </Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
@ssddanbrown commented on GitHub (Jul 18, 2019): There's no `/login` folder, All requests are routed through `public/index.php` which is what the redirects enable. In regards to a VirtualHost, With apache you'd often define a virtualhost block in the apache config files, something like this: ```apache <VirtualHost *:80> ServerName my.domain.com ServerAdmin webmaster@localhost DocumentRoot /var/www/bookstack/public/ <Directory /var/www/bookstack/public/> Options Indexes FollowSymLinks AllowOverride None Require all granted <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ```
Author
Owner

@Fuuzz commented on GitHub (Jul 18, 2019):

Thank you for the reply!
My virtualhost was not set like this, only contained the main virtualhost instructions.
I tried to copy the block content, restarted the httpd service, but I don't see any notable change in the redirection, still showing "404 Not Found".
Error display on the .env file is set, i solved some error messages, but right now it doesn't seems like there is any error in processing the files.

@Fuuzz commented on GitHub (Jul 18, 2019): Thank you for the reply! My virtualhost was not set like this, only contained the main virtualhost instructions. I tried to copy the </Directory> block content, restarted the httpd service, but I don't see any notable change in the redirection, still showing "404 Not Found". Error display on the .env file is set, i solved some error messages, but right now it doesn't seems like there is any error in processing the files.
Author
Owner

@ssddanbrown commented on GitHub (Jul 19, 2019):

I'm not really familiar with CentOS but I wanted a minecraft server so have set up a little VPS and am using CentOS to learn the OS a little better. I'll have a play at the weekend with BookStack and apache on it and see if I can put together some steps or a quick guide.

@ssddanbrown commented on GitHub (Jul 19, 2019): I'm not really familiar with CentOS but I wanted a minecraft server so have set up a little VPS and am using CentOS to learn the OS a little better. I'll have a play at the weekend with BookStack and apache on it and see if I can put together some steps or a quick guide.
Author
Owner

@Fuuzz commented on GitHub (Jul 19, 2019):

Sounds nice, let me know if you encounter this issue or you think of a possible solution!
If you need any other log or info on the configuration i set just ask, i'll try to find out other ways to workaround the problem in the meanwhile.

@Fuuzz commented on GitHub (Jul 19, 2019): Sounds nice, let me know if you encounter this issue or you think of a possible solution! If you need any other log or info on the configuration i set just ask, i'll try to find out other ways to workaround the problem in the meanwhile.
Author
Owner

@ssddanbrown commented on GitHub (Jul 20, 2019):

@Fuuzz I've now created a CentOS 7 installation script which can be found here:
https://github.com/BookStackApp/devops/blob/master/scripts/installation-centos-7.sh
I've tested this on a virtual machine. Note that this is designed for a fresh instance only since it performs full system setup for BookStack but hopefully there are bits you can use.

The Apache virtualhost setup is this part:
c85b867acb/scripts/installation-centos-7.sh (L79-L125)

If you're not running the whole script, you'll need to change the ServerName parameter to be your domain name for BookStack (eg. docs.example.com).

Let me know if that helps or if you run into any other issues.

@ssddanbrown commented on GitHub (Jul 20, 2019): @Fuuzz I've now created a CentOS 7 installation script which can be found here: https://github.com/BookStackApp/devops/blob/master/scripts/installation-centos-7.sh I've tested this on a virtual machine. **Note that this is designed for a fresh instance only** since it performs full system setup for BookStack but hopefully there are bits you can use. The Apache virtualhost setup is this part: https://github.com/BookStackApp/devops/blob/c85b867acb3b620f69dcdc0a4256aaafd2c58308/scripts/installation-centos-7.sh#L79-L125 If you're not running the whole script, you'll need to change the `ServerName` parameter to be your domain name for BookStack (eg. `docs.example.com`). Let me know if that helps or if you run into any other issues.
Author
Owner

@Fuuzz commented on GitHub (Jul 23, 2019):

Hello @ssddanbrown, thank you for taking it this far :)
After checking and messing around a bit, i found out there was a wrong line on the .conf file for my domain in Apache folder, and it was messing up everything.
Just a quick, last question, dunno if 'm blind or dumb, but I don't find where logins credentials for my panel are stored, and how to set new login infos; I didn't manage to find anything about this at https://www.bookstackapp.com/docs/.
Thank you again :)

@Fuuzz commented on GitHub (Jul 23, 2019): Hello @ssddanbrown, thank you for taking it this far :) After checking and messing around a bit, i found out there was a wrong line on the .conf file for my domain in Apache folder, and it was messing up everything. Just a quick, last question, dunno if 'm blind or dumb, but I don't find where logins credentials for my panel are stored, and how to set new login infos; I didn't manage to find anything about this at https://www.bookstackapp.com/docs/. Thank you again :)
Author
Owner

@ssddanbrown commented on GitHub (Aug 3, 2019):

@Fuuzz Glad to hear you got things working! Will close this off then.

Just a quick, last question, dunno if 'm blind or dumb, but I don't find where logins credentials for my panel are stored.

Not really sure what's meant by this. The default admin user account is admin@admin.com with a password of password. Obviously this should be changed after first logging in.

New users can be created in the "Settings" > "Users" area when logged in via the admin account.

@ssddanbrown commented on GitHub (Aug 3, 2019): @Fuuzz Glad to hear you got things working! Will close this off then. > Just a quick, last question, dunno if 'm blind or dumb, but I don't find where logins credentials for my panel are stored. Not really sure what's meant by this. The default admin user account is `admin@admin.com` with a password of `password`. Obviously this should be changed after first logging in. New users can be created in the "Settings" > "Users" area when logged in via the admin account.
Author
Owner

@sivarajkumar237 commented on GitHub (Jun 11, 2021):

After checking and messing around a bit, i found out there was a wrong line on the .conf file for my domain in Apache folder, and it was messing up everything.

May I know what is the name of .conf file you modified in Apache folder?

@sivarajkumar237 commented on GitHub (Jun 11, 2021): > After checking and messing around a bit, i found out there was a wrong line on the .conf file for my domain in Apache folder, and it was messing up everything. May I know what is the name of .conf file you modified in Apache folder?
Author
Owner

@Fuuzz commented on GitHub (Jun 25, 2021):

Hi, the .conf file was the one for the domain I installed bookstack on, like domain.conf in domain folder in var/www.

@Fuuzz commented on GitHub (Jun 25, 2021): Hi, the .conf file was the one for the domain I installed bookstack on, like `domain.conf` in domain folder in var/www.
Author
Owner

@Glaiverion commented on GitHub (Oct 15, 2024):

There's no /login folder, All requests are routed through public/index.php which is what the redirects enable.

In regards to a VirtualHost, With apache you'd often define a virtualhost block in the apache config files, something like this:

<VirtualHost *:80>
	ServerName my.domain.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/bookstack/public/

    <Directory /var/www/bookstack/public/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
        <IfModule mod_rewrite.c>
            <IfModule mod_negotiation.c>
                Options -MultiViews -Indexes
            </IfModule>

            RewriteEngine On

            # Handle Authorization Header
            RewriteCond %{HTTP:Authorization} .
            RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

            # Redirect Trailing Slashes If Not A Folder...
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_URI} (.+)/$
            RewriteRule ^ %1 [L,R=301]

            # Handle Front Controller...
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^ index.php [L]
        </IfModule>
    </Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Hello im using windows 10 and xampp, and im having the same issues
where do i copy paste this virtual host script? thanks

@Glaiverion commented on GitHub (Oct 15, 2024): > There's no `/login` folder, All requests are routed through `public/index.php` which is what the redirects enable. > > In regards to a VirtualHost, With apache you'd often define a virtualhost block in the apache config files, something like this: > > ```apache-config > <VirtualHost *:80> > ServerName my.domain.com > > ServerAdmin webmaster@localhost > DocumentRoot /var/www/bookstack/public/ > > <Directory /var/www/bookstack/public/> > Options Indexes FollowSymLinks > AllowOverride None > Require all granted > <IfModule mod_rewrite.c> > <IfModule mod_negotiation.c> > Options -MultiViews -Indexes > </IfModule> > > RewriteEngine On > > # Handle Authorization Header > RewriteCond %{HTTP:Authorization} . > RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] > > # Redirect Trailing Slashes If Not A Folder... > RewriteCond %{REQUEST_FILENAME} !-d > RewriteCond %{REQUEST_URI} (.+)/$ > RewriteRule ^ %1 [L,R=301] > > # Handle Front Controller... > RewriteCond %{REQUEST_FILENAME} !-d > RewriteCond %{REQUEST_FILENAME} !-f > RewriteRule ^ index.php [L] > </IfModule> > </Directory> > > ErrorLog ${APACHE_LOG_DIR}/error.log > CustomLog ${APACHE_LOG_DIR}/access.log combined > > </VirtualHost> > ``` Hello im using windows 10 and xampp, and im having the same issues where do i copy paste this virtual host script? thanks
Author
Owner

@ssddanbrown commented on GitHub (Oct 15, 2024):

@Fuuzz You'd need to alter the config for Windows use. I have a guide for XAMPP/Windows use here: https://www.youtube.com/watch?v=_v-4BhVz7OI

@ssddanbrown commented on GitHub (Oct 15, 2024): @Fuuzz You'd need to alter the config for Windows use. I have a guide for XAMPP/Windows use here: https://www.youtube.com/watch?v=_v-4BhVz7OI
Author
Owner

@drgdiegoruiz commented on GitHub (Oct 12, 2025):

Hello.

Hope this message is helpfull to someone.

I was performing manual installation on Ubuntu 25_04 and faced the "404 Not Found" on the /login page.

I found that with the provided config you have to enable apache module rewrite.

sudo a2enmod rewrite
sudo systemctl restart apache2

I didn't find mention to this step on the installation document and i believe it could be usefull.

Regards

@drgdiegoruiz commented on GitHub (Oct 12, 2025): Hello. Hope this message is helpfull to someone. I was performing manual installation on Ubuntu 25_04 and faced the "404 Not Found" on the /login page. I found that with the provided [config](https://codeberg.org/bookstack/devops/src/branch/main/config/apache/bookstack.conf) you have to enable apache module rewrite. `sudo a2enmod rewrite` `sudo systemctl restart apache2` I didn't find mention to this step on the [installation document](https://www.bookstackapp.com/docs/admin/installation/) and i believe it could be usefull. Regards
Author
Owner

@ssddanbrown commented on GitHub (Oct 13, 2025):

Thanks @drgdiegoruiz, I've updated that example config to mention the need for mod_rewrite as hint.

@ssddanbrown commented on GitHub (Oct 13, 2025): Thanks @drgdiegoruiz, [I've updated](https://codeberg.org/bookstack/devops/commit/7de45b7b354153472d09d8318d5d7a327df61e22) that example config to mention the need for mod_rewrite as hint.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1265