Custom 404 pages.. making them work...

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
wwonderfull
 
 
Posts: 1255
Joined: Fri Aug 21, 2020 8:27 am

Re: Custom 404 pages.. making them work...

Post by wwonderfull »

All I wanted to do was build a custom 404 page. I already designed it and uploaded it. http://www.kreemerz.com/error/404.html
404 pages not so much needed if you have a small website 1-5 page website where you change pages yearly and not monthly or daily. Websites where people upload pages and delete frequently need it the most. You can put a simple, beautiful and artistic way of displaying 404 error page. I personally used 404 error page with simple html page and a beautiful illustration.

For the php error page as @bacon has given the code, you might have to do that I can assure on that. But if you as you stated want everything simple then you can do an html 404 error page depending on your needs you should implement. So it would be your decision 1st hand.
User avatar
kreemerz
 
 
Posts: 90
Joined: Wed Apr 06, 2022 2:58 pm
Contact:

Re: Custom 404 pages.. making them work...

Post by kreemerz »

wwonderfull wrote: Sun Apr 24, 2022 5:13 am
All I wanted to do was build a custom 404 page. I already designed it and uploaded it. http://www.kreemerz.com/error/404.html
404 pages not so much needed if you have a small website 1-5 page website where you change pages yearly and not monthly or daily. Websites where people upload pages and delete frequently need it the most. You can put a simple, beautiful and artistic way of displaying 404 error page. I personally used 404 error page with simple html page and a beautiful illustration.

For the php error page as @bacon has given the code, you might have to do that I can assure on that. But if you as you stated want everything simple then you can do an html 404 error page depending on your needs you should implement. So it would be your decision 1st hand.
I guess the issue I'm having is how to make it work.. how do I get it to show up when you access a nonexistent page.

With the code <?php http_response_code(404); include('/error/404.php'); // provide your own HTML for the error page die();?> , do I place this in the same file (error/404.php)? or does it go in the .htaccess file?

Do I need this line of code as well, "ErrorDocument 404 /mywebsite.com/error/404.php" line?
wwonderfull
 
 
Posts: 1255
Joined: Fri Aug 21, 2020 8:27 am

Re: Custom 404 pages.. making them work...

Post by wwonderfull »

I guess the issue I'm having is how to make it work.. how do I get it to show up when you access a nonexistent page.

With the code <?php http_response_code(404); include('/error/404.php'); // provide your own HTML for the error page die();?> , do I place this in the same file (error/404.php)? or does it go in the .htaccess file?

Do I need this line of code as well, "ErrorDocument 404 /mywebsite.com/error/404.php" line?
For the php code I can say our dear moderator @bacon can assist you with his grateful advice on that.
Do I need this line of code as well, "ErrorDocument 404 /mywebsite.com/error/404.php" line?
404 error page whether it is php or html both needs the .htaccess code. and yes it needs to be put inside your websites directory's .htaccess.

Code: Select all

RewriteEngine on
ErrorDocument 404 http://www.yoursite.com/404.php
or in some cases

Code: Select all

RewriteEngine on
ErrorDocument 404 /errors/404.php
User avatar
kreemerz
 
 
Posts: 90
Joined: Wed Apr 06, 2022 2:58 pm
Contact:

Re: Custom 404 pages.. making them work...

Post by kreemerz »

Hmmm... so in Cpanel, I need to add that code to add to the Error 404 page here right?

https://privatebin.support-tools.com/?7 ... GqXMDQdYI=
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Custom 404 pages.. making them work...

Post by WWBman »

Your error page is http://www.kreemerz.com/error/404.html
So the entry in the .htaccess file should be:
ErrorDocument 404 /error/404.html

Just one thing:
See my first reply regarding CSS style sheets.
If this rule still applies then this may be why things are jumbled up.

EDIT:
I've just tested it and the rule still applies.
I.E. The page must not have any external css style sheets so the option Tools > Option > HTML > CSS must be unticked
User avatar
kreemerz
 
 
Posts: 90
Joined: Wed Apr 06, 2022 2:58 pm
Contact:

Re: Custom 404 pages.. making them work...

Post by kreemerz »

WWBman wrote: Sun Apr 24, 2022 8:08 am Your error page is http://www.kreemerz.com/error/404.html
So the entry in the .htaccess file should be:
ErrorDocument 404 /error/404.html

Just one thing:
See my first reply regarding CSS style sheets.
If this rule still applies then this may be why things are jumbled up.

EDIT:
I've just tested it and the rule still applies.
I.E. The page must not have any external css style sheets so the option Tools > Option > HTML > CSS must be unticked
But isn't CSS needed for the rest of the site? I'm sure it's already uploaded to the servers. Would I need to delete the CSS folders?
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Custom 404 pages.. making them work...

Post by WWBman »

You can still use CSS just the same but untick the option Tools > Options > HTML > CSS > Generate external CSS style sheets for page specific styles.
I create a separate project just for the error page in its own folder..
That way only the error page project has the option unticked and all other projects can have the option ticked.
That's how I do it anyway.
User avatar
kreemerz
 
 
Posts: 90
Joined: Wed Apr 06, 2022 2:58 pm
Contact:

Re: Custom 404 pages.. making them work...

Post by kreemerz »

WWBman wrote: Sun Apr 24, 2022 2:50 pm You can still use CSS just the same but untick the option Tools > Options > HTML > CSS > Generate external CSS style sheets for page specific styles.
I create a separate project just for the error page in its own folder..
That way only the error page project has the option unticked and all other projects can have the option ticked.
That's how I do it anyway.
1. So I created a seperate project in WebBuilder and built the 404 page, made the page a PHP one in the builder, unticked the CSS sections.. Uploaded it.
2. Went into cPanel, went to Error pages and pasted ErrorDocument 404 /error/404.php into the page as seen below:
https://privatebin.support-tools.com/?1 ... B0jfE1qU=
3. Tested by going to klnexus.com/notapage and my custom page still wont show. I get the default 404. Not sure why this is such a pain. Seemed like it was so easier of a process before.

🤷‍♂️
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Custom 404 pages.. making them work...

Post by WWBman »

You don't put the ErrorDocument 404 /error/404.php there it needs to be in the .htaccess file.
So if you are creating and publishing your error page project in the /error folder then that's exactly how my setup is.
wwonderfull
 
 
Posts: 1255
Joined: Fri Aug 21, 2020 8:27 am

Re: Custom 404 pages.. making them work...

Post by wwonderfull »

Use the html 404 error page instead would do less hassel for you I think. It's much easier to implement which is very basic.
User avatar
kreemerz
 
 
Posts: 90
Joined: Wed Apr 06, 2022 2:58 pm
Contact:

Re: Custom 404 pages.. making them work...

Post by kreemerz »

wwonderfull wrote: Sun Apr 24, 2022 6:09 pm Use the html 404 error page instead would do less hassel for you I think. It's much easier to implement which is very basic.
Still paste the same html code into the .htaccess file?
User avatar
kreemerz
 
 
Posts: 90
Joined: Wed Apr 06, 2022 2:58 pm
Contact:

Re: Custom 404 pages.. making them work...

Post by kreemerz »

WWBman wrote: Sun Apr 24, 2022 5:13 pm You don't put the ErrorDocument 404 /error/404.php there it needs to be in the .htaccess file.
So if you are creating and publishing your error page project in the /error folder then that's exactly how my setup is.
Okay. I might have done that. But I'll give it a try again.
User avatar
kreemerz
 
 
Posts: 90
Joined: Wed Apr 06, 2022 2:58 pm
Contact:

Re: Custom 404 pages.. making them work...

Post by kreemerz »

I finally got it to work.

Thank you all for your patience with me... I really appreciate it. I'm still learning some of this stuff..

@baconfries
@wwonderfull
@WWBman

Looks like the issue was that I was using the errorpage section of cPanel (using Bluehost's KB) and not going directly to the htaccess file...
User avatar
kreemerz
 
 
Posts: 90
Joined: Wed Apr 06, 2022 2:58 pm
Contact:

Re: Custom 404 pages.. making them work...

Post by kreemerz »

WWBman wrote: Sun Apr 24, 2022 2:50 pm You can still use CSS just the same but untick the option Tools > Options > HTML > CSS > Generate external CSS style sheets for page specific styles.
I create a separate project just for the error page in its own folder..
That way only the error page project has the option unticked and all other projects can have the option ticked.
That's how I do it anyway.
While this method does work for me, I do get broken links (where images are missing) on those error pages. Not sure what's causing that. Maybe my occasional upload of updates... kinda a drag to have to keep opening up a new project and uploading the error pages from there.

@wwonderfull had suggested the 'html error page' way of doing this.. I'm now wondering if that may be less of a hassle.
wwonderfull
 
 
Posts: 1255
Joined: Fri Aug 21, 2020 8:27 am

Re: Custom 404 pages.. making them work...

Post by wwonderfull »

While this method does work for me, I do get broken links (where images are missing) on those error pages. Not sure what's causing that. Maybe my occasional upload of updates... kinda a drag to have to keep opening up a new project and uploading the error pages from there.
@wwonderfull had suggested the 'html error page' way of doing this.. I'm now wondering if that may be less of a hassle.
404 error page is very simple to know.
In reality I my self as a user rarely got 5 views of 404 error page in a hole year of website browsing. Because the website is removed or has technical problems or the page has been removed from websites host server and showing on google's search engine result for some days before termination. 404 error page was just for a simple indication for people to know that the server cannot find the requested resource. Some people use searches and all that depending on what kind of content they have if they have hundreds and thousands of page they can use searches on 404 error page to lead to another page. But as I said it was an indication for people to know that the server cannot find the requested resource.

So just to show that "page not found" line people made simplest of way to show it from html to php. its just a basic text in the corner saying page not found. But now in modern days people added visuals backgrounds animations and more advanced use of it. It really depends on you what you want people to do when people find your broken page. If you want you can redirect a 404 error page user back to home page or the new page you have created.

HTML or PHP the main purpose is to show people that the "server cannot find the requested resource". So that being known, now I think you can decide what you would like to do with an 404 error page. You can use it creatively or you can use it natively meaning classic.
Last edited by wwonderfull on Tue May 24, 2022 7:52 am, edited 2 times in total.
User avatar
zinc
 
 
Posts: 2146
Joined: Sat Dec 08, 2007 3:06 pm
Location: London, United Kingdom
Contact:

Re: Custom 404 pages.. making them work...

Post by zinc »

wwonderfull wrote: Sun Apr 24, 2022 6:44 am
I guess the issue I'm having is how to make it work.. how do I get it to show up when you access a nonexistent page.

With the code <?php http_response_code(404); include('/error/404.php'); // provide your own HTML for the error page die();?> , do I place this in the same file (error/404.php)? or does it go in the .htaccess file?

Do I need this line of code as well, "ErrorDocument 404 /mywebsite.com/error/404.php" line?
For the php code I can say our dear moderator @bacon can assist you with his grateful advice on that.
Do I need this line of code as well, "ErrorDocument 404 /mywebsite.com/error/404.php" line?
404 error page whether it is php or html both needs the .htaccess code. and yes it needs to be put inside your websites directory's .htaccess.

Code: Select all

RewriteEngine on
ErrorDocument 404 http://www.yoursite.com/404.php
or in some cases

Code: Select all

RewriteEngine on
ErrorDocument 404 /errors/404.php

Very useful. Thank you!
Running WYSIWYG Web Builder since 2007...
Post Reply