How do I create a .htaccess file?

Here's a quick guide on how to create a text file suitable for the .htaccess file:

1. Open a text editor on your computer. We recommend that you use Notepad (Windows), SimpleText (Macintosh), or Emacs (Linux / UNIX).

2. Save the file as .htaccess (including the period at the beginning of the name).

3. Make sure that your editor did not save the file with the .txt extension (In Windows, you can check this by right-clicking on the file and selecting "Properties"). If the filename has a .txt extension (i.e. '.htaccess.txt') then rename the file.

4. Before entering text into the file, make sure that "Word Wrap" is turned off. (Select "Format" in the top bar in Notepad and uncheck the box). This is important because most of the commands in the .htaccess file should be on one line only.

5. You can now enter text.

6. Upload the .htaccess file to the server with ASCII encoding. The rules in the .htaccess file will apply to all folders and subdirectories in which it is located.

  • 57 Users Found This Useful
Was this answer helpful?

Related Articles

How to change theme manually in Wordpress?

To change the WordPress theme manually, you will need to edit the wp-config.php file. Please add...

Comparison of WordPress and Joomla

WordPress and Joomla are the most popular CMS. Both web engines are free, open source, extensible...

How to make PHP code execute in .html files

Very often people ask how to make php inserts work in ordinary .html files, and in general the...

How to block IP address using .htaccess file?

You can block access to your site from certain IP addresses using the .htaccess file. You need to...

CMS PrestaShop Review, Installation Guidelines and Login to Control Panel

PrestaShop - one of the leading CMS for e-commerce, is a great analogue of Magento, as it is open...