blueprintue / blueprintue-self-hosted-edition

Useful if you want to host your own blueprintUE website for your company.
https://blueprintue.com
MIT License
46 stars 7 forks source link

404 message for all pages except home #37

Closed timjzee closed 3 months ago

timjzee commented 5 months ago

Hi Rancoud,

First of all, thank you so much for developing and open sourcing this beautiful product!

I've been trying to setup blueprintUE locally, but I'm running into a problem. Probably because of my lack of PHP knowledge. I have the feeling that it is a really simple issue but I just can't figure it out. So I thought I would ask you in case it is a really easy fix.

The problem: After following the instructions in the Readme, I can go to localhost and it shows me the home page. I can also paste in a blueprint, and it will be saved to disk and entered into the database. However, whenever I try to go to a different page, for example curl http://localhost/contact/, I get the Apache 404 page:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache/2.4.52 (Ubuntu) Server at localhost Port 80</address>
</body></html>

I'm having a hard time debugging this, because I can't find any errors in the logs. Do you have any idea what might be happening here? Any suggestions would be super helpful!

Tim

rancoud commented 5 months ago

Hello,

Thank you for using blueprintUE 👍

Regarding your error, it's because the web server is looking for a folder called contact but it doesn't exist. To do this, we use URL rewriting, which allows us to do some URL manipulations.

The Apache module mod_rewrite is a very powerful and sophisticated module which provides a way to do URL manipulations. With it, you can do nearly all types of URL rewriting that you may need. It is, however, somewhat complex, and may be intimidating to the beginner. There is also a tendency to treat rewrite rules as magic incantation, using them without actually understanding what they do.

To solve the problem, you need to enable the Apache mod_rewrite module, you can use this command:

a2enmod rewrite

I hope this helps.

timjzee commented 5 months ago

Thanks so much for the quick response!

Unfortunately, this didn't fix it yet. I restarted everything and made sure that the rewrite mod was enabled. I'll keep trying stuff, but if something comes to mind please let me know.

Have a nice weekend!

rancoud commented 4 months ago

Have you succeeded in solving your problem?

timjzee commented 4 months ago

Hi, I tried running ContactTest.php and that worked, so it really seems it's something related to my Apache or PHP configuration. I also briefly looked at the .htaccess file, but couldn't find anything obvious.

I'll try to debug some more this week, as getting this running would really help me document our projects. If I do end up solving it, I'll be sure to let you know :).

Jnewbon commented 4 months ago

I also encountered this error today while using NginX and php-fpm, i figured out that you need to configure the site to handle this as a single-page application using the following locations in the server section of the nginx config

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/run/php-fpm/www.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
    }

Might not help you directly but if you can find the apache equivalent it could help

timjzee commented 4 months ago

Thanks @Jnewbon, I'll take a look!

timjzee commented 3 months ago

I'm an idiot. I did not specify AllowOverride All for all relevant folders in my apache2.conf file. Sorry for the confusion, and thanks for the help! You can close the issue if you want :)

rancoud commented 3 months ago

Thanks for the updates, I hope it will help other people 👍