How To Create A Custom 404 'Page Not Found' Page
If you've ever visited a web page and instead of seeing the page you receive a 404 error saying the requested URL was not found, you'll know how frustrating it can be to visitors at your own site. The page may have been deleted, or maybe the website reorganized its content and moved the page. Visitors only receive a generic server response in plain text, without an option to navigate to your main site. So they leave and look elsewhere (someone else's website) to find what they're looking for.
Encourage your visitors who end up on a 404 page to stay on your website by creating a custom 404 landing page. You only need to do two things to have it up and running in minutes.
1. Create A Custom 404 Page
You'll want to create a page that visitors see that let's them know the page wasn't found. It's also nice to include a brief mention of any changes that may have ocurred. Maybe you've reorganized your content and the page is now under a different directory. A little humor is also nice to help offset frustration. Name the file whatever you want (404.php, not-found.html, etc). If you're using our PHP Website Template, open the file blank.php, enter the text you want visitors to see, then Save As 404.php.
2. Create Or Modify Your .htaccess file
Next, you'll need to tell your server to display the custom 404 page whenever a requested page is not found. You do this by creating or modifying the .htaccess file to include the following:
ErrorDocument 404 http://phpwebsitetemplates.com/404.php
FTP/upload both these files to the root of your server and you're good to go.
Sticky Side Column
If you're using our PHP Website Template, this is the optional side bar column you can add to some or all of your pages. It can be useful for adding advertisements such as Adsense ads to be displayed on multiple pages.
When you include the side column, your main content will automatically adjust its width to accommodate it.
The side bar is 'sticky'; it will scroll down and remain in view.
You can turn on/off the side bar column per page by defining the $showSide option located at the top of each file.