Htaccess and wordpress
If you are running a wordpress blog then you should come across htaccess file. If you are running a wordpress in some “One Click Wordpress Hosting” sites like godaddy, bluehost, dreamhost etc then you may not know about the htaccess file. In these One Click Wordpress hosting sites, htaccess is installed by default. But if you are hosting your own wordpress blog or installing on your own then you might have to create the htaccess file on yourself. Htaccess file is used in wordpress for the pretty Permalink.
Permalinks are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings. A permalink is what another weblogger will use to link to your article (or section), or how you might send a link to your story in an e-mail message. The URL to each post should be permanent, and never change hence its called permalink.
There are basically two types of Permalinks in Wordpress i.e Ugly Permalinks and Pretty Permalinks.
The Ugly Permalinks are the default configuration in wordpress and they dont need a .htaccess file. The Ugly Permalink would look something like
www.ravikhanal.com/?p=N
These Ugly Permalinks are the default permalinks and dos not utilize .htaccess file and are not Search engine Optimized too.
The Pretty Permalink are search engine optimized URL. If you want your blog to be optimized in search engine you would most likely want to have the pretty Permalink. The pretty permalink will be something like
www.ravikhanal.com/htaccess-and-wordpress/
If you want to have some pretty permalinks like this then you would need a htaccess file.
How to Put the htaccess file in your wordpress blog:
- First open a notepad with blank content and name it as 1.htaccess
- Put the 1. htaccess file on your server
- Rename the 1.htaccess file to .htaccess file
- Copy this code inside the .htaccess file and save the file
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress