In my personal website at http://www.lavanyadeepak.tk/, I have the top like 'index.php?pg=profile', 'index.php?pg=home' or 'index.php' (without any querystring), 'index.php?pg=diary' etc. I am looking to see if I can have .htaccess file which can make me create links like index.php/ index.php index.php/home index.php/profile index.php/diary Is this possible? Can some one help me write an .htaccess for the same please?
Hi Deepak, The solution here could help you: http://www.9lessons.info/2009/11/pretty-urls-with-htaccess-file.html Basically you will need to make all the links in your site to the way you want it. Eg: http://www.lavanyadeepak.tk/profile Then you can put redirect rules in your .htaccess like below: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?pg=$1 </IfModule> The RewriteCond lines make sure the re_write rules do not mess with any files names your site might have. The RewriteRule line takes all characters from starting (^) to end ($) after your domain name, and pass it on to variable $1. The "/?" makes sure that any trailing "/" are also accommodated for in the query. Of course, you will need to test this thoroughly for your environment and make necessary modifications before using it in live site. Good Luck!