Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bookstack] Missing modification of .htaccess to make rewrite rules work #1499

Closed
jce-zz opened this issue Mar 9, 2023 · 4 comments · Fixed by #1786
Closed

[bookstack] Missing modification of .htaccess to make rewrite rules work #1499

jce-zz opened this issue Mar 9, 2023 · 4 comments · Fixed by #1786
Labels
bug Something isn't working. ✨Goodie for three PRs

Comments

@jce-zz
Copy link
Contributor

jce-zz commented Mar 9, 2023

U7 requires to add "RewriteBase /" to .htaccess files to make redirects work. This instruction is missing and when following the guide it only throws a 500 error.

@luto luto added the bug Something isn't working. ✨Goodie for three PRs label Mar 9, 2023
Systemsemaphore added a commit to Systemsemaphore/lab that referenced this issue Jul 14, 2024
@Systemsemaphore
Copy link
Contributor

Sorry for necroing an issue from 03/23.

Sadly (or luckily?), I can't replicate the error. I've followed the guide for testing purposes and was able to access BookStack right after completing the last step php artisan migrate
It was not necessary to edit the .htaccess file. I can create shelves, books and pages without any errors.

I've made little changes to the guide in order to emphasize the most important steps --> #1786

@jce-zz Have you managed to get it up and running after all this time? If not, I'm happy to help, just drop me a message.

@jce-zz
Copy link
Contributor Author

jce-zz commented Jul 14, 2024

Yes, I got it running with the fix I described. I'm pretty sure it will never work without adding the RewriteBase statement (as documented in the Uberspace guide). If it worked for you OOTB, the maybe this statement is now somehow part of the standard config of BookStack?

@Systemsemaphore
Copy link
Contributor

Systemsemaphore commented Jul 14, 2024

Interesting. I took a look inside the .htaccess file that came with BookStack:

<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]

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

So, interestingly enough, no RewriteBase / here. Did you clone BookStack to a directory one level above your DocumentRoot and then remove your unused DocumentRoot, creating a symlink to the BookStack/public directory instead? Or is BookStack one of multiple projects / subdomains on your Asteroid? Afaik, that's the only case where you'd have to use RewriteBase / for it to work.

My installation for testing purposes is still up and open for public view, registration is disabled though: https://labtest.uber.space/shelves

I've mostly followed the old guide to set it up, with a single, slight change (PHP 8.3 instead of 8.1, as it's now supported officially, see BookStackApp/BookStack#4633). No modifications to the .htaccess file at all.

@jce-zz
Copy link
Contributor Author

jce-zz commented Jul 14, 2024

Actually, I am running it as a subdomain. Then this might be the missing piece to add, or maybe just a note with a link to the main Uberspace docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. ✨Goodie for three PRs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants