开发者

Rewrite rule for this

开发者 https://www.devze.com 2023-02-03 21:28 出处:网络
Please help me for this mod_rewrite result how i can get u开发者_如何转开发sing .htaccess http://www.domain.com/artist.php?userid=2&name=username

Please help me for this mod_rewrite result

how i can get u开发者_如何转开发sing .htaccess

http://www.domain.com/artist.php?userid=2&name=username

to

http://www.domain.com/saquib

please help


You can easily rewrite requests like /saquib internally to /artist.php?name=saquib by using a rule like this:

RewriteRule ^[a-z]+$ artist.php?name=$0

But the problem with your example is the user ID that cannot be obtained from the requested URI path. So unless you use a path that also contains the user ID (e.g. /2-saquib), the user names need to be unique to identify the users just by their user name.

By the way: You should think about using a unique path prefix as some kind of namespace for your users like /users/….

0

精彩评论

暂无评论...
验证码 换一张
取 消