Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

tako izu
tako izu
13,676 Points

How do I make an error 404 page in treehouse workspaces

I'm trying a method where you create a .htaccess file and then run it in the root directory, but it doesn't look like Treehouse Workspaces support .htaccess files. This is what I'm trying to put in the file:

ErrorDocument 404 /unknown.html

Is there another way that I can make a 404 error page when a user types in an unknown URL?

1 Answer

Steven Parker
Steven Parker
216,891 Points

It works fine for me, maybe there's something odd about the workspace organization.

Take a look at this video about sharing a snapshot of your workspace.

tako izu
tako izu
13,676 Points

this is what the workspace looks like https://w.trhou.se/6mkeznxecs

Steven Parker
Steven Parker
216,891 Points

This workspace has no .htaccess file, but after I added one with your intended content the custom error page was successfully served when I tried to access a non-existent location.

Note that the built-in workspace editor doesn't recognize the type of a file with that name, but you can use it to create a text file and then rename it.

Oddly, the workspace did have a file named fourzerofour.htaccess, but it was empty and that's not the correct name.