Customize 404 page.

xanmean
Jr. Bludit
Posts: 5
Joined: Tue Jan 29, 2019 7:14 pm

How to customize 404 page. Thank you.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

It's easy:
  • Create a page.
  • Go to "Settings" > "General" > "Advanced" and enter the name of the page in the field "Page not found".
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
abdulhalim
Master Bludit
Posts: 128
Joined: Thu Mar 10, 2016 6:25 pm
Location: Bandar Abbas
Been thanked: 4 times
Contact:

Hello Edi,

There is not fancy with 404 error page, I customized the template I used, I add author info box and etc to the page, Also the page shows in the menu!
Is there any way to redirect to the HTML page?

Best Regards,
Abdulhalim
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 pm

abdulhalim wrote: Mon Feb 18, 2019 5:28 pm
Is there any way to redirect to the HTML page?
just use apache's error document handler, and point to a static html with below command:

Code: Select all

ErrorDocument 404 /404.html
User avatar
abdulhalim
Master Bludit
Posts: 128
Joined: Thu Mar 10, 2016 6:25 pm
Location: Bandar Abbas
Been thanked: 4 times
Contact:

Thank you, Jay

I put it into htaccess file, but it doesn't work, I think it needs to edit some of php file to redirect properly.

Regards,
Abdulhalim
User avatar
Jay
Master Bludit
Posts: 133
Joined: Mon Feb 11, 2019 8:41 pm

abdulhalim wrote: Tue Feb 19, 2019 6:22 am Thank you, Jay

I put it into htaccess file, but it doesn't work, I think it needs to edit some of php file to redirect properly.

Regards,
Abdulhalim
I should guess, that easiest methods doesn't work in general.
Basically you should check your access log, and see if the 404.html document is found in the path you use once you hit a "404 - page not found".
Otherwise try with one of below :

Code: Select all

ErrorDocument 404 /absolute/path/to/html/document/on/your/webhost/account/404.html
or

Code: Select all

ErrorDocument 404 http://yourdomain/404.html
try to put this handler before bludit's rewrite commands, as it's more important than cms redirects which ends with [L] (it means, that once they're hit, htaccess won't check further commands)


ps. I assume your webhosting provider uses apache webserwer, or at least has a port of htaccess directives interpreter.
User avatar
abdulhalim
Master Bludit
Posts: 128
Joined: Thu Mar 10, 2016 6:25 pm
Location: Bandar Abbas
Been thanked: 4 times
Contact:

Thank you, Jay

I used this command before, but this time it doesn't work, also I want to redirect from HTTPS to HTTP, this command doesn't work! but for non-www to www, it's OK.

Maybe there is an issue related to my server.

Thank you anyway
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

abdulhalim wrote: Mon Feb 18, 2019 5:28 pm There is not fancy with 404 error page, I customized the template I used, I add author info box and etc to the page, Also the page shows in the menu!
You can add a condition to the navigation, that excludes the 404 error page. Is it a normal or a static page?
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
abdulhalim
Master Bludit
Posts: 128
Joined: Thu Mar 10, 2016 6:25 pm
Location: Bandar Abbas
Been thanked: 4 times
Contact:

it's a static page, how can I do that? :shock:
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Using the theme Blekathlon you can modify the loop with the titles in the file aside.php (in the directory /bl-themes/blekathlon/php) as follows if the slug of your error page is for example "error-404" (line 39):

Code: Select all

                        <?php foreach ($staticContent as $staticPage) : ?>
                        	<?php if ($staticPage->slug() != "error-404") { ?>
                        	<li class="menu-item">
                        	    <a href="<?php echo $staticPage->permalink(); ?>">
                        	        <?php echo $staticPage->title(); ?>
                        	    </a>
                        	</li>
                            <?php } ?>
                        <?php endforeach ?>
instead of

Code: Select all

                        <?php foreach ($staticContent as $staticPage) : ?>
                        	<li class="menu-item">
                        	    <a href="<?php echo $staticPage->permalink(); ?>">
                        	        <?php echo $staticPage->title(); ?>
                        	    </a>
                        	</li>
                        <?php endforeach ?>
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply