TinyPortal

Development => Block Codes => Topic started by: lebisol on November 05, 2007, 06:00:26 AM

Title: Using Article As Custom 404 Page
Post by: lebisol on November 05, 2007, 06:00:26 AM
Hello everyone,
I am not sure this post belongs here nor if the topic was addressed before but I was messing with the idea and got it to work.
Here is how you can have a custom 404 page that is easy to maintain as it is to edit your article.

1. In TP create a new article and display your message. Make sure you publish the article (and adjust its options to your needs) and enter "Query Title".
For the sake of this tutorial query title and name are "NotFound"
2.  Create a new document in Notepad or other simple editor and paste the code:
ErrorDocument 404 /404.php
and "Save as type" - All Files  with the filename of ".htaccess" note the dot in the file name.
If you already have ".htaccess" file you can just add code to it.
3.  Now create a another new document and paste the code of:
<?php
header
('Location: http://www.YourDomain.com/index.php?page=NotFound');
?>


where you would edit code and enter your domain name  and page and then and "Save as type" - All Files   with the filename of "404.php"
4. Upload both ".htaccess" and "404.php" files into the root of your site "/public_html/".
5. Test by going to your site and entering random url.

You can get as creative with your custom error pages as you can with articles.
Here is lazy verions of mine http://MostarNetworks.com/itworks
All the best!