How do I rename a file to .htaccess in Windows 7?
Thanks to https://serverfault.com/questions/22626/rename-files-to-empty-filename-in-windows-vista I learned a new trick. Since this page shows up in Google higher for that error message, I thought I'd link it here too.
Essentially if you want to do it in Explorer, name it .htaccess.
with a trailing dot. The trailing dot tells Windows what the extension should be, and the initial dot and letters tell it what the filename (without extension) should be. It appears that a file without an extension is permissible, but not one without a filename. Fortunately, a file without an extension requires no dot, so we get the deletion that creates the filename we wanted (which is just an extension - see the filetype that Windows reports?)
You can do this with any string, not just htaccess
. It makes a little sense to me because files that start with a dot have special meaning.
this link discusses the same problem on XP.
I'll let you read it and decide if it applies to Windows 7, but the solution involves using a command line.
EDIT:
It starts from the fact that Windows will let you create an htaccess.txt
file
Then
Start Run > cmd
then type
rename c:\pathtoyourhtaccessfile\htaccess.txt .htaccess
will do the trick
Don't create the file in Windows Explorer. Create it in whatever program you are using (notepad, vim, eclipse whatever). Then select "Save As" and make sure "All Files" is selected. Type in .htaccess . It should work.
The All Files is to prevent the program automatically adding a file type extension (e.g. .htaccess.txt)