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
  • 18,888
  • 26
  • 91
  • 124
  • 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
  • 620,600
  • 104
  • 758
  • 828
1
RewriteRule ^user/(.+)$ user.php?user=$1 [L,QSA]
Ayman Hourieh
  • 122,950
  • 22
  • 139
  • 114