1

I'm developing a website using xampp on my Windows computer. But when I try to rename the file htaccess.txt to .htaccess in order to enable rewrite rules in Joomla, I get an error message:

File rename error

How can I rename this file?

3

In Windows Explorer, the path of least resistance is to select the file then press F2 to rename it (or right-click and choose Rename), then rename to:

.htaccess.

enter image description here

Notice the trailing dot (.), make sure you add that too. Hit enter and confirm that you want to rename the file and voila:

enter image description here

(I have a monkey head icon because I've got Helicon Tech's APE installed.)

Most of the Windows standard "Save As" dialogues will also let you save files named with a leading period this way as well provided you save as the type All files (*.*).

|improve this answer|||||
  • Nice, I wasn't aware of that little trick. I'll accept this answer as it is by far the simplest solution. – johanpw Nov 25 '14 at 14:48
4

Good answer provided by @Johanpw.

Personally, what I always do is open the htaccess.txt file in a text editor. For me, I tend to use Notepad++ for simplicity.

Once done, simply go to File >> Save As (CTRL + ALT + S) and name the file .htaccess.

Job done

|improve this answer|||||
  • Another good option, I forgot about that. Note that if you use the regular Windows Notepad, you need to select "All Files" in the "save as type" field. If not, Notepad will add a .txt file type to the file. – johanpw Nov 24 '14 at 16:34
  • Easiest option +1 – jonboy Nov 24 '14 at 20:02
  • Notepad++ reference +1, also; most IDEs can handle the renaming as well. Notepad++ is also create for fixing corrupted file charset encoding which language definition files are picky about. – Brian Bolli Nov 24 '14 at 21:36
2

Background
As the message confirms, Windows does not allow empty file names. The .htaccess file is used on Linux systems, and the dot (.) in front of the name is used to make it a hidden file. However, Windows files consists of a name (before the dot) and a file type (after the dot), thus interpretting the "name" of the file as empty, and the file type as htaccess.

So how can this limitation be overcome on a Windows system? Windows has no problems copying and editing a file named .htaccess if it already exists, it's just renaming the file that causes problems.

Solution 1
It's possible to rename the file using the command prompt (previously DOS, for those who remember pre-windows times).

  1. Browse to the root folder of your localhost Joomla installation (e.g. c:\xampp\htdocs\myjoomla)
  2. Go to File - Open command prompt (or use this keyboard shortcut: Shift + Menu, W, Enter)
  3. You should see a black window with the text C:\xampp\htdocs\myjoomla>_, indicating the current folder location.
  4. Type rename htaccess.txt .htaccess in order to rename the file (no confirmation is given, but the file is renamed)
  5. Close the window (or type exit)

Rename .htaccess file

Solution 2
Another alternative is to copy an existing .htaccess from another Joomla installation (or download from an online Joomla installation). As mentioned earlier, the nameless file can be copied and edited without any problems by Windows.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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