0

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

ManWithNoName
  • 67
  • 2
  • 13
  • If you use Apache web server [mod_rewrite](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) may help you. – VisioN May 11 '12 at 12:49
  • I think similar to http://stackoverflow.com/questions/5880410/how-to-display-a-user-name-in-url – Vik May 11 '12 at 12:49
  • You need implement Friendly url. Check this [article][1] [1]: http://stackoverflow.com/questions/812571/how-to-create-friendly-url-in-php – Alexander Gharibashvili May 11 '12 at 12:50

2 Answers2

1

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]
Jeroen
  • 13,056
  • 4
  • 42
  • 63
0

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

Tiago Peczenyj
  • 4,387
  • 2
  • 22
  • 35