example.com/members/username

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
8803286
Forum Newbie
Posts: 2
Joined: Mon Mar 31, 2014 5:02 pm

example.com/members/username

Post by 8803286 »

Hi i'm trying to do like this:

http://example.com/members/username

Then the profile of that user will come up.

But idk how to do it.

Only know how to do /members/?u=username


I'M SORRY FOR MY ENGLISH!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: example.com/members/username

Post by requinix »

It's called URL rewriting. Exactly how you do it depends on your web server; most people have Apache and end up with something in their .htaccess looking like

Code: Select all

RewriteEngine on
RewriteRule ^/?members/([^/]+) /members/index.php?u=$1 [L]
Keep in mind that URL rewriting only lets you handle URLs like "/members/username" - you still have to output them in your HTML manually.
8803286
Forum Newbie
Posts: 2
Joined: Mon Mar 31, 2014 5:02 pm

Re: example.com/members/username

Post by 8803286 »

Thanks
Post Reply