you're reading...
Technology

Creating a custom 404 Page on douglawrence.org, using PHP and HTML

www.douglawrence.org custom 404 pageI’ve been spending way too much time recently on the ‘work-in-progress’ www.douglawrence.org website. So when I came across a custom 404 theme ‘Lost in Space – Error 404’ (by adraft) on ThemeForest, I couldn’t resist downloading and customising it to work with my website.  It’s the best $4 I’ve ever spent.

douglawrence.org is based on a WordPress theme called U-Design. The 404 page, however, is based on HTML. I placed the 404 theme’s HTML code in a directory called custom404 at the top level within ‘httpdocs’. Fortunately U-Design had a custom 404 page written in PHP, I backed that up, then used the following code to redirect from the 404 page ‘PHP’ to the custom 404 (index) page.

PHP code to redirect to custom404 page

This may not be the most elegant solution but is works. You can try it by visiting www.douglawrence.org/custom404/ or trying to reach a page that doesn’t exist on douglawrence.org.

I edited the text using Dreamweaver to include the ‘milk’ comment – well I had to really just to prove I’d done some work! 🙂

About Doug Lawrence

I help businesses to grow internationally

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 24 other followers

Twitter Updates

%d bloggers like this: