I also want to know that can I have dynamic contents with .html extension.
I mean how can I change the .php extension to .html ??
Put this in your .htaccess:
And... add this line to your .htaccess:
.htaccess is a powerfull thingy
Can you please explain what is this and how it works ???
Difficult to explain, but I'll try.
It uses the apache module mod_rewrite which lets you rewrite URLs based on certain conditions.
This is a condition. If this condition is met, the rewrite rule below it will be used. Basically it says something like: if the querystring of the url begins with user= then the condition is met, and put the text after user= up to the next = or the end of the string in a variabele named %1.
This is the rewrite. It will be used if the condition above is true, and it means something like: if the URL is index.php replace it with the content of variable %1.
if someone asks for www.site.com/index.php?user=john, the url is "index.php" (the part which specifies the host is removed) and the query string is "user=john". The query matches the specified pattern and "john" is stored in %1. Since the url matches the pattern of the rewrite rule ("index.php") it is replaced by the content of %1, so the new url is "john". The removed host part is added again, and the result is: www.site.com/john.