Last updated on December 27th, 2015 at 11:44 am
Here are couple of examples for URL using  .htaccess
1)Rewriting user.php?id=12 to user-12.html
It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?†character) is converted into a static URL.
RewriteEngine on
RewriteRule ^user-([0-9]+)\.html$ user.php?id=$1
2) Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz
Have you checked zorpia.com.If you type http://zorpia.com/roshanbh233 in browser you can see my profile over there. If you want to do the same kind of redirection i.e http://yoursite.com/xyz to http://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
how’re you doing guys?
Amazing !!!!
Hello all
I am new to this board but this is superbbbbbbbbbbbbb
Hello all
I am new to this board, a good one.
Hi admin i put your code on my web but it not work this code
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
this my url it not change http://khmerera.com/detail?ads=22 it show detail too how can i do cos i want hide detail i want show like this http://khmerera.com/?ads=22 help me please Thz!
Hi Sovann,
Thanks for your comment,
Try this
Your URL should look like this
http://khmerera.com/ads=22
Hope you are fine with this.
Regards
Admin[Mistonline.in]
Hi , i am using your code on my web but it not work this code
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
this my url it not change http://zameenmarket.com/view.php?ads=21 it show detail too how can i do this becoz i want hide detail i want show like this http://zameenmarket.com/22
where i am wrong help me please
Hi Murtaza,
First question is whether you have changed/customized the rule according to your requirement. Here your URL looks like http://zameenmarket.com/view.php?ads=21, So basically the htaccess code will go like this
Update your .htaccess with the above rule. Make sure you save the.htaccess in your root directory or location where you have the view.php file placed. Then try to run this URL http://zameenmarket.com/22
Hope this helps. If not get back to me with the details of what you have done.
Regards
Admin