Monday, December 19, 2011

8:47 AM
For better SEO optimization and make urls more search engine friendly , remove index.php from URL and make it easier to read.

Remove index.php from URL can be done by writing only two lines in your .htaccess(mod_rewrite in apache) file. Before writing this rule in .htaccess , make sure that your mod_rewrite is enabled(On) in your apache server. 


Most probably mod_rewrite is enabled in Linux server but for windows server , you need to contact hosting people to make mod_rewrite enabled. You can check this by looking in phpinfo().


Below is the Rules which will remove index.php from URL using .htaccess. Look at below links for .htaccess rules.


RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\
HTTP/ RewriteRule ^(([^/]+/)*)index\.php$ http://www.%
{HTTP_HOST}/ [R=301,NS,L]



Redirect 301 means Moved Permanently so most search engines will remove index.php from URL.

0 comments: