ManWithNoName
ManWithNoName

Reputation: 167

displaying username in url... www.example.com/JoeMason

Kind of simple i would assume, but can't seem to find any answers here which will help me out.

Basically instead of displaying

www.example.com/profile.php

I want to display the username of the person which is logged in.

www.example.com/JoeMason

Is there any simple method to achieve this?#

Thanks

Upvotes: 0

Views: 398

Answers (2)

Tiago Peczenyj
Tiago Peczenyj

Reputation: 4623

you can use a rewrite rule to o this, to change from

www.example.com/profile.php?user=JoeMason

to

www.example.com/JoeMason

see the .htaccess or rewrite rule in the nginx conf

Upvotes: 0

Jeroen
Jeroen

Reputation: 13257

Yes, you can use mod rewrite to rewrite www.example.com/JoeMason to www.example.com/profile.php?name=JoeMason

Try adding this to your .htaccess file:

RewriteEngine On
RewriteRule ^/(.*)/$ http://www.example.com/profile.php?name=$1 [L]

Upvotes: 1

Related Questions