1

I want to make my user profiles 'pretty' as it were. Here is the regular URL:

user.php?user=UserName

I want this to become:

user/Username

Please help :) Im a .htaccess newbie.

Ben Shelock
  • 20,154
  • 26
  • 92
  • 125
  • 1
    You already asked something *very* similar to this: http://stackoverflow.com/questions/930420/htaccess-question – hbw May 30 '09 at 22:42
  • I think this would be more appropriate: http://stackoverflow.com/questions/904075/using-mod-rewrite-to-change-url-with-username-variable – Gumbo May 30 '09 at 22:45

2 Answers2

3

Try these directives:

RewriteEngine on
RewriteRule ^user/([^/]+)$ user.php?user=$1 [L,QSA]

This rule rewrites any request with a URL path of the form /user/foobar internally to /user.php?user=foobar.

Gumbo
  • 643,351
  • 109
  • 780
  • 844
1
RewriteRule ^user/(.+)$ user.php?user=$1 [L,QSA]
Ayman Hourieh
  • 132,184
  • 23
  • 144
  • 116