Tuesday, January 14, 2014

Making URLs SEO friendly using .htaccess

Making URLs SEO friendly is tried by many web developers and they use .htaccess to achieve it. Before proceeding to use .htaccess method you should enable Rewrite Module on your server. By default it's enabled.

By using this method you can remove the extension of a file and make it accessible without it's extension.
For example: http://www.example.com/example.php to http://www.example.com/example

That's quite interesting to have pretty URLs for search engines to index. Because the crawler index it according to the keyword.

Here the code which you have save in the root directory of your server.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php


No comments:

Post a Comment

Your Comment Will Be Visible After Approval, Thanks !