Editing Rewrite Rules (.htaccess)
Your server must have mod_rewrite for cruft-free permalinks to work. In addition, you must create a .htaccess file and place it in the directory in which your main index.php file resides. For example, if your WordPress blog is installed at domain.com/wordpress/, put the .htaccess file at domain.com/wordpress/.htaccess. However, if your WordPress installation is in a subdirectory, but your visitors access your site at the top level of your domain, place the .htaccess file at domain.com/.htaccess.
When you create a permalink structure, WordPress will generate rewrite rules for you to copy and paste into your .htaccess file.
A few cautions about creating and editing your .htaccess file:
- You must have FTP access to create the .htaccess file
- You must chmod the .htaccess file to 666 to edit it with the WordPress template editor. Do not leave your file’s permissions set to 666 as it may be accessible by anyone. After applying the permalinks, change the permissions to something stronger, like 660, to protect it.
- If you leave whitespace at the end of your .htaccess file, it may make all pages on your site unavailable (though they will still exist, and your data will not be harmed). If this happens, delete the .htaccess file and create a new one.
- If your .htaccess file contains errors that bring down your site, you will need to use FTP or your host’s control panel to delete the rogue .htaccess file. Once a fatal change has been saved in the WordPress editor, the editor (along with the rest of your site) will not be available until the problem is fixed.
- You may also be able to use your host’s control panel to create and edit the .htaccess file. If so, it is likely you will still be able to edit the .htaccess file through this method, even if errors in the file have brought down your site itself.