简体   繁体   中英

user friendly URL rewrite rule

Could anyone advise on how to I can rewrite this url:

https://test.com/user/user.php?u=name

to

 https://test.com/user/user/name

Please?

Below is my rewrite rule but it's not doing exactly what I want.

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)/user/([^/]+) /user.php?u=$1 [L]

Thanks a lot

Try this:

RewriteEngine On
RewriteRule ^user/user/([^/]*)/?$ /user/user.php?u=$1 [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM