Search code examples
laravel.htaccessshared-hosting

How to point bookstack (Laravel) application's public folder on a mydomain.com/bookstack


Hi I am trying to host bookstack application which is basically a larvel application on a shared hosting, After uploading database dump from local and uploading all the files to public_html/bookstack folder.

Now I am able to visit the webapp at https://example.com/bookstack/public , but I want to host the site at example.com/bookstack only and don't want the "public" in url.

I have two questions,

1) How to achieve it using .htaccess file?

2) Inside the .env file there is an option

# Application URL
# Remove the hash below and set a URL if using BookStack behind
# a proxy, if using a third-party authentication option.
# This must be the root URL that you want to host BookStack on.
# All URL's in BookStack will be generated using this value.

#APP_URL=https://example.com

So if here I put APP_URL as https://example.com/bookstack , and remove the comment, its first giving "403 Forbidden - You don't have permission to access this resource." error and if I visit to https://example.com/bookstack/public it works fine.

Update : So I found this subdirectory setup page in bookstack documentation but it only describe how to setup if I have access of apache, which is not possible in case of shared hosting


Solution

    1. Move the .htaccess file in /public to root.
    2. Rename server.php file in root to index.php.