How To change My Url to user friendly using php and mysql !
any Example :
i have this url for show user profile:
1 http://mydomain.com/showuser.php?id=30 //<- this link show user with id 30
change to friendly Url :
1 http://mydomain.com/user/john //<- this john is name of id 30
Thanks for any help.
This isn't just a PHP/MySQL functionality, read up on Apache's mod_rewrite (assuming you're running a LAMP stack)
You can definitely make use of Apache's mod_rewrite or Nginx's HttpRewriteModule to aid in this endeavor. If you're using something other than Apache or Nginx, the first thing you should be doing is dumping it and installing one or the other of the aforementioned web servers. ;)
On to the point though, rewrite rules are an excellent way to perform simple tasks such as removing file extensions from the url, or redirecting all 404's to a single point of entry (amongst many other fancy tricks), but rewriting your entire site one section at a time is a little bit horrendous. Especially if you're attempting to create a distributable app.
While I think the author of this article is completely off base about the 'right' way to do things, and you have to take their opinion (as with mine) with a grain of salt, it is nevertheless a pretty good article on the basics of the subject. http://www.roscripts.com/Pretty_URLs...iting-168.html -- it will introduce you to the concepts of doing it either way so that you can make the final decision as to which is best for you; just remember that when you get to the part about doing it via PHP the first sentence makes it sound an awful lot like he is about to tell you the wrong way to do things and that if you can't grasp the earlier concept you must be learning disabled of some kind. What he doesn't mention is that nearly all major CMS software does it this way, as well as most of the major frameworks as well.
|All times are GMT. The time now is 06:47 PM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0