Creating a .htaccess file for WordPress

Create a htaccess file with gedit

Create a WordPress htaccess file with Gedit

Some of the functions and features for optimizing WordPress for Search Engines require you to modify the .htaccess file.  If you cannot locate the .htaccess file in the root directory of your home page (the root directory will also contain your index.php file) you may have to create one locally and then upload it to the root directory of your web server.

Creating a .htaccess file for your WordPress blog.

Step 1: Open Notepad in Windows, Gedit in Linux or a similar text based editor.

Step 2: Paste the following into your blank text file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Step 3: Save the text file as 1.htaccess

Step 4: Upload to your root directory.

Step 5: Rename the file to .htaccess by removing the “1″.

That’s it.  You have now created the .htaccess file.  When making changes to the Permalink features on your WordPress blog you will be prompted to update the .htaccess file with snip-its of code.  This can be done in the same method using a text editor or automatically be changing the file permissions on the .htaccess file.

For more information on editing file permissions check out the WordPress.org website.