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:
How can I rename this file?
Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. It only takes a minute to sign up.
Sign up to join this communityI'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:
How can I rename this file?
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.
Notice the trailing dot (.
), make sure you add that too. Hit enter and confirm that you want to rename the file and voila:
(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 (*.*)
.
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
.txt
file type to the file.
– johanpw
Nov 24 '14 at 16:34
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).
c:\xampp\htdocs\myjoomla
)C:\xampp\htdocs\myjoomla>_
, indicating the current folder location.rename htaccess.txt .htaccess
in order to rename the file (no confirmation is given, but the file is renamed)exit
)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.