Welcome to the Treehouse Community
Looking to learn something new?
Julian Ptak30,920 Points
Is there a Treehouse video or class that deals with .htaccess creation and activation?
I'm working on a project currently that requires that I write an .htaccess file to do something really simple: just a 404 error redirection.
I've got my code in the .htaccess file and the file is on the server. The code (in its entirety) is as follows:
ErrorDocument 404 /404.php
For some reason, the redirection isn't happening. I am completely new to .htaccess file creation so if there is other syntax I'm missing, I wouldn't know.
While I really do need the solution to this problem ASAP, I also want to learn why it works or is broken. So if there is a Treehouse video on this or if anyone has a quick and dirty explanation/solution, I'd really appreciate it.
My initial googling of the problem brought back all sorts of creation tips and tricks and also debugging for Rewrite rules but Stack Overflow doesn't tend to have stuff this simplistic. Any ideas?
In case it makes a difference, the site I am working on is running on a Microsoft server.
Shawn FlaniganCourses Plus Student 15,803 Points
Randy touches on .htaccess files in the Enhancing a Simple PHP Application course (under Cleaning URLs with Rewrite Rules), but I don't remember him going into 404s or other Error Documents.
In your post, it looks like you have some spaces in front of your
ErrorDocument statement. If so, try deleting any spaces or line breaks before and after your code...see if that helps.