Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using XAMPP to test a PHP script. Now, in the root of the folder I want to place a .htaccess file according to the requirements of the script.

But Windows won't let me rename it to .htaccess. Is there any way to go around it?

I'm using Windows 7 RTM.

share|improve this question

6 Answers 6

up vote 48 down vote accepted

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.


It starts from the fact that Windows will let you create an htaccess.txt file

Start Run > cmd

then type

rename c:\pathtoyourhtaccessfile\htaccess.txt .htaccess

will do the trick

share|improve this answer
did the trick thanks! –  rzlines Oct 17 '09 at 16:32
LOL that's another weird issue caused by Windows! –  Ahmad Alfy Sep 25 '11 at 8:27
Well this was more simple than I expected. Thank you. –  TheNAkos Jan 19 at 11:30

Thanks to http://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 file without an extension is permissable, 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.

share|improve this answer
Sigh. Frustrating. :) Thanks! –  Robert P Aug 23 '11 at 19:48
That's just weird! –  Web_Designer Feb 3 '12 at 4:15
This is the best thing I've ever learned. If only I could give you more upvotes... –  leek Mar 19 '12 at 8:49
is this a bug or a feature? –  etuardu Jul 5 '12 at 19:31
it's a bug until someone finds a use for it then it's a feature... this is now officially a feature. :) –  jx12345 Nov 12 '14 at 14:59

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)

share|improve this answer

One thing you could do is use another file as the .htaccess file.

Open up the httpd.conf or whatever the XAMPP setup calls the Apache configuration file.

Look for the line that starts with AccessFileName and change the value at the end to something that Windows will allow you to save it as.

AccessFileName htaccess.txt

If you don't find that line, just add the above in.

Then restart your XAMPP.

You will have to remember to rename it when you upload to the live site though.

share|improve this answer
Maybe this answer took the "any way to go around it" too literally. –  random Oct 17 '09 at 13:30

I think in the old Windows XP days it was sufficient to just quote the filename? Those quotes would then be removed by Windows. So, rename to save the file as:


This surely only works when saving from, say, Notepad, and then also keeps the default .txt from being added. I am not 100% sure it also worked in Windows Explorer. In Windows XP, it does not work from Windows Explorer though, as one cannot even type quotes then. And without the quotes it would yield "You must type a file name." because it doesn't like the leading dot. The same errors when using the dialog as shown using right-click » Properties.)

share|improve this answer

There is a better, simpler way. At least in Win7 (and the Win8 dev preview), as I have not attempted it in other windows versions.

Simply name it .htaccess. The ending dot will be automatically removed, leaving it named .htaccess

No idea why windows works this way, but it is far simpler than CMD or notepad methods. Just type an extra dot at the end.

share|improve this answer
This is an exact duplicate of this answer from over a year ago. –  Tim Pietzcker Jan 6 '12 at 6:38
"exact"? No. Anyway, I was lookinfor the answer to this problem and figured it out on my own. But since I had never seen anone say this before, I searched on here for this question, so I could make sure anyone else needing to know got the information. The accepted answer is a lesser answer, so I posted. Didn't notice the othere one. The asker should change the accepted answer to that one though, since it is a far better answer. –  zeel Jan 6 '12 at 16:54
And you realize it confuses people if an answer is correct, but voted down. Now, while my answer is totally correct, others seeking this information may be mislead by the negative score. –  zeel Jul 12 '12 at 4:29
FWIW, I didn't downvote this. But in my opinion, you should remove your answer because the other answer is much better: it doesn't just say "It's magic!" but explains why it works. And you were about a year late with yours. –  Tim Pietzcker Jul 12 '12 at 5:22
The previous answer does not mention explicitly: that the trailing dot will disappear - that way this answer still holds its ground. –  Ujjwal Singh Dec 6 '12 at 10:03

protected by studiohack Jan 6 '12 at 5:57

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.