On occasion, I get questions like "I created a file called
blahblahblah.html using Notepad, and after uploading it to my website
and testing it with my browser, I get a 404 File Not Found error. What do I do?" Another variant of this question is
"I tried to save my file as
blahblahblah.pl but when I uploaded it to my website, I can only find
blahblahblah.pl.txt. How do I get the file to be
This brief article explains how you can solve this type of problem.
If it's a "File Not Found" error that you have, before we proceed to fixing the problems created by Notepad, it is important to first eliminate the possibility that you uploaded the file to the wrong directory.
Web servers are configured so that they serve files only from certain locations. They don't, for example, display your email from your mail folders for all to see. Typically, on your web hosting account, you have to upload your files into a directory called "www" or "public_html". Find out from your web host where you need to upload your files so that they will be displayed correctly.
If you have checked and know for sure that you have not committed this error, move on to the next section.
The other possible reason for the error is Notepad. Notepad, up to the current version, has the practice of adding a ".txt" extension
to your files even when you don't specify it. So if you give your file a name of "
blahblahblah.html", Notepad will change
the name to "
blahblahblah.html.txt" without informing you. Compounding this problem is Windows Explorer's policy
of not telling you the full filename of your files. Hence if you use Explorer to check the file, it will only show
If you have already saved your file, the best way to solve this is to first force Explorer to always show you the file extension, and then change the filename to the correct one. This is good practice anyway, since always being able to see the full filename probably improves your system's security — you'll be less likely to be tricked by all those scams asking you to click a file that appears to be a picture but is actually a program.
On Windows Vista and above, lick the Start menu, and type "folder options" (without the quotes), and click the "Folder Options" line that appears near the top of the Start menu. Click the "View" tab in the dialog box that appears. Look for a setting "Hide file extensions for known file types" and uncheck the box beside it to disable it. Then click the "OK" button at the bottom of the dialog box. (If your version of Windows does not seem to behave as I describe here, or the steps are too vague, see the more detailed instructions in my full tutorial on this.)
You should now be able to see your file as its true name, be it "
blahblahblah.html.txt" or whatever. Now click once on the filename.
Explorer will now allow you to change the filename. If this is not true, select the filename and hit the F2 key on the keyboard.
Delete the ".txt" extension, leaving the filename as "
blahblahblah.php" (without the quotes) or
blahblahblah.html". Make sure there are no trailing dots or spaces — that is, make sure
the filename is really "
blahblahblah.php" and not "
blahblahblah.php." with a trailing dot or the like.
When you hit the ENTER key, Windows will issue a warning about the dangers of changing filenames. Allow the name change to take place.
While this fixes the problem, read the next section to find out how you can avoid having to repeatedly do this in future, every time you use Notepad.
When you want to force Notepad to save a file without the "
.txt" extesion, save the file as "
including the quotes, in the Save As dialog box. When you include the quotes, Notepad will save the file
blahblahblah.php name literally, without adding a
Alternatively, you may prefer to get a better text editor. There are numerous free ones on the Free Programmer's Text Editors page. Don't worry about the "programmer's editor" bit — despite its grandiose name, programmers' editors are simple text editors with additional features to make it easier to work with than Notepad.
Do you find this article useful? You can learn of new articles and scripts that are published on thesitewizard.com by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at https://www.thesitewizard.com/thesitewizard.xml. You can read more about how to subscribe to RSS site feeds from my RSS FAQ.
This article is copyrighted. Please do not reproduce or distribute this article in whole or part, in any form.
It will appear on your page as: