从user.php切换?user_id=$1/仅为user.php/$1/

0sgqnhkj  于 2023-10-15  发布在  PHP
关注(0)|答案(1)|浏览(114)

我有一个URL是/forums/user.php/?user_id=6/,但我希望它只是/forums/user.php/6/和工作。我怎么能这么做呢?
我试图做添加到.htaccess编辑网址,但它不太工作,它只是空白

RewriteEngine On
RewriteRule ^user\.php/([^/]+)/?$ user.php?user_id=$1 [L]
x4shl7ld

x4shl7ld1#

将此行添加到.htaccess

RewriteEngine On
RewriteRule ^forums/user\.php/([^/]+)/?$ /forums/user.php/?user_id=$1 [L,NC,QSA]

相关问题