.htaccess file is a very important file if you are using the Apache Web server for serving your website. .htaccess file let’s allow you to configure, control advanced features of your web server with some simple command inside the file. This file located at the document_root folder of your Website.We can create and edit the htaccess file on the server. But if you want to develop your site locally (for example XAMPP local server), then you will encounter that you can not create the file. Every time you try to create you get an error like this: You must type a filename. In this tutorial, we will learn how to create and edit the .htaccess file in the Windows computer.
Why I’m getting that error?
When you create a file on Microsoft Windows computer, you can not leave empty in the file name field. That means you must need to specify the file name and additionally with the file name extension. Windows computer distinguish the file name and file name extension with a full stop (.) , Before the full stop it acts as the filename and after the full stop, it acts as file name extension (traditionally). But in case of creating .htaccess file, before the full stop, it seems to be empty in the file name field. And that’s why windows think the file name is empty and also think htaccess is the file name extension.
Let’s see how to avoid this error and create, edit the htaccess file on Windows.
Create .htaccess file on Windows Computer
To create a .htaccess file on the windows computer we don’t need additional software. Notepad is enough to create the file. Follow the instruction below:
- Open the Notepad from your installed application list.
- Write anything inside your notepad, or write some htaccess command.
- Then press
Ctrl + Sto save the file. A save file dialog box will appear.
- Now in the filename field write .htaccess
- Finally, from the file type field, select All Files and hit
- The .htaccess file will be saved in your selected location.
Hope that it worked!