Beautiful custom page 404 error

Started by artvolt, July 05, 2020, 06:15:04 AM

Previous topic - Next topic

artvolt

Tell me, please, how to create a beautiful custom page for error 404, same as on this support forum - https://www.simplemachines.org/art . That there was a standard forum formatting and buttons of transition to the main page. This is very important to me. Please, help.

SMF Forum - "Art Cafe" - https://art-cafe.info/

YogiBear

SMF v2.1.3  Mods : Snow & Garland v1.4,  PHP  v.7.4.33

artvolt

No, this mod does not create a beautiful 404 graphic page. And with mod and without mod, page 404 looks like this:



I need such a page 404:

SMF Forum - "Art Cafe" - https://art-cafe.info/

Arantor

Well, let's start with the important question, what kind of server hosting do you have? This requires server-level changes to accomplish.

artvolt

Quote from: Arantor on July 05, 2020, 07:46:00 AM
Well, let's start with the important question, what kind of server hosting do you have? This requires server-level changes to accomplish.

"Server: nginx-reuseport/1.13.4"
SMF Forum - "Art Cafe" - https://art-cafe.info/

Arantor

So, next question, is that nginx in front of Apache as a reverse proxy, or is it the only front-facing server using PHP-FPM?

artvolt

I don't know where to get information about such complex issues at my hosting.

It is possible to get instructions for all server settings options?
SMF Forum - "Art Cafe" - https://art-cafe.info/

Arantor

No, not really, that's the point.

Depending on whether you have nginx with PHP-FPM or nginx with Apache/PHP, the answer might be 'sorry, no, you can't do this unless you're the server administrator'.

The fact you don't know suggests you probably won't have the power to implement it.

artvolt

I am testing several hosting services for future installation of the forum.

Technical support for all hosting says that installed - "Nginx / Apache"
SMF Forum - "Art Cafe" - https://art-cafe.info/

Arantor

It's really not that simple, though and *it matters* for doing this.

You can have Apache only hosting, nginx only hosting, or a combination of both - and you do the 404 differently in each case.

Your hosting doesn't make it easy to help you, as it isn't clear *how* they're using either or both. What I can definitely tell you is that if it's nginx only, you won't get 404s, if it's nginx+Apache together there's a chance you won't.

You could always ask your host how to set a custom 404 handler that is a PHP page, we can go from there.

artvolt

Analyzers show that the site "simplemachines.org" is installed "nginx":



At the same time, a beautiful graphic page 404 errors was made:

SMF Forum - "Art Cafe" - https://art-cafe.info/

Arantor

I didn't say it couldn't be done. I said *you* probably couldn't do it since to set up 404 handlers in nginx requires access to the server config. The people who run this site have access to the servers themselves (because they literally run the servers themselves).

The fact you're asking me these questions means you don't have access to the server config itself, which means you almost certainly won't be able to sort it out. Ask your host.

artvolt

Arantor, thanks for the explanation. I'm just starting to learn how to work with hosting and forum SMF. I do not have access to the server configuration. And I very need a "404 error" page that would have a link to the main forum page. I will consult with the hosting provider.
SMF Forum - "Art Cafe" - https://art-cafe.info/

Arantor

Hopefully it'll turn out that they use nginx as a reverse proxy in front of Apache, and I can give you Apache instructions that will do the job.

shadav

correct me if i'm wrong but couldn't you just add to your .htaccss
ErrorDocument 401 /401-3.php
ErrorDocument 403 /401-3.php
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php


then create these files and edit them how you like?

Arantor

Quote from: shadav on July 05, 2020, 04:56:41 PM
correct me if i'm wrong but couldn't you just add to your .htaccss
ErrorDocument 401 /401-3.php
ErrorDocument 403 /401-3.php
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php


then create these files and edit them how you like?

Only if you are on Apache and only if AllowOverride is suitably configured. All available evidence suggests neither of these are true for the OP.

Sir Osis of Liver

Do you have cPanel -> Advanced -> Error Pages?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Quote from: Sir Osis of Liver on July 05, 2020, 06:40:34 PM
Do you have cPanel -> Advanced -> Error Pages?


I assume his host would confirm such things, which is why asking them is usually the best place to start.

Sir Osis of Liver

Quote from: artmix on July 05, 2020, 01:58:47 PM
I am testing several hosting services for future installation of the forum.

Appears he's host hunting, that would be something to look for (my host has it).  Much simpler than getting involved in server configuration.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

It's not a case of 'simpler', it's a case of if you're on nginx as the sole frontend and you don't have server config, you have zero choice in the matter.

nginx doesn't support .htaccess style files. That's one of the downsides to it, the upside being that not scanning for per-folder config makes it way faster, and why some folks run it as a frontend in front of Apache, so that nginx does the lifting for static files like gifs (because it can do it faster than Apache) and then relays the rest to Apache.

Advertisement: