Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: artvolt on July 05, 2020, 06:15:04 AM

Title: Beautiful custom page 404 error
Post by: artvolt on July 05, 2020, 06:15:04 AM
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.

Title: Re: Beautiful custom page 404 error
Post by: YogiBear on July 05, 2020, 06:55:24 AM
Perhaps this..?

https://custom.simplemachines.org/mods/index.php?mod=3969 (https://custom.simplemachines.org/mods/index.php?mod=3969)
Title: Re: Beautiful custom page 404 error
Post by: artvolt on July 05, 2020, 07:36:56 AM
No, this mod does not create a beautiful 404 graphic page. And with mod and without mod, page 404 looks like this:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimages.vfl.ru%2Fii%2F1593948462%2Fe07b61dc%2F30991836_m.jpg&hash=43a3a423912c185bd283a0a97f678fd1dff41606)

I need such a page 404:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimages.vfl.ru%2Fii%2F1593948914%2F57916189%2F30991899_m.jpg&hash=c90eb6a0057668e2773e257a80fe72dadc633aec)
Title: Re: Beautiful custom page 404 error
Post by: 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.
Title: Re: Beautiful custom page 404 error
Post by: artvolt on July 05, 2020, 10:20:08 AM
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"
Title: Re: Beautiful custom page 404 error
Post by: Arantor on July 05, 2020, 10:21:46 AM
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?
Title: Re: Beautiful custom page 404 error
Post by: artvolt on July 05, 2020, 11:39:50 AM
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?
Title: Re: Beautiful custom page 404 error
Post by: Arantor on July 05, 2020, 12:03:55 PM
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.
Title: Re: Beautiful custom page 404 error
Post by: artvolt on July 05, 2020, 01:58:47 PM
I am testing several hosting services for future installation of the forum.

Technical support for all hosting says that installed - "Nginx / Apache"
Title: Re: Beautiful custom page 404 error
Post by: Arantor on July 05, 2020, 02:05:25 PM
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.
Title: Re: Beautiful custom page 404 error
Post by: artvolt on July 05, 2020, 03:25:23 PM
Analyzers show that the site "simplemachines.org" is installed "nginx":

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimages.vfl.ru%2Fii%2F1593976628%2Ffcda1fdf%2F30995539_m.jpg&hash=2a049fe582f897d333763bb44c9886204297488b)

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

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimages.vfl.ru%2Fii%2F1593948914%2F57916189%2F30991899_m.jpg&hash=c90eb6a0057668e2773e257a80fe72dadc633aec)
Title: Re: Beautiful custom page 404 error
Post by: Arantor on July 05, 2020, 03:36:37 PM
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.
Title: Re: Beautiful custom page 404 error
Post by: artvolt on July 05, 2020, 04:42:13 PM
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.
Title: Re: Beautiful custom page 404 error
Post by: Arantor on July 05, 2020, 04:54:42 PM
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.
Title: Re: Beautiful custom page 404 error
Post by: 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?
Title: Re: Beautiful custom page 404 error
Post by: Arantor on July 05, 2020, 04:58:34 PM
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.
Title: Re: Beautiful custom page 404 error
Post by: Sir Osis of Liver on July 05, 2020, 06:40:34 PM
Do you have cPanel -> Advanced -> Error Pages?
Title: Re: Beautiful custom page 404 error
Post by: Arantor on July 05, 2020, 06:47:44 PM
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.
Title: Re: Beautiful custom page 404 error
Post by: Sir Osis of Liver on July 05, 2020, 06:57:59 PM
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.

Title: Re: Beautiful custom page 404 error
Post by: Arantor on July 05, 2020, 07:25:14 PM
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.