问题
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.
回答1:
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
.
回答2:
RewriteRule ^user/(.+)$ user.php?user=$1 [L,QSA]
来源:https://stackoverflow.com/questions/930789/htaccess-pretty-user-profile-urls