用户名 mod 重写
我需要 mod 重写方面的帮助...我正在尝试更改
domain.com/user.php?username=foo
为
domain.com/foo
我当前的重写是:
RewriteRule username/(.*)/ user.php?username=$1 [L]
RewriteRule username/(.*) user.php?username=$1 [L]
输出
domain.com/username/foo
但我对此不满意。
I need help with mod rewrite ...I'm trying to change
domain.com/user.php?username=foo
to
domain.com/foo
My current rewrite is:
RewriteRule username/(.*)/ user.php?username=$1 [L]
RewriteRule username/(.*) user.php?username=$1 [L]
which outputs
domain.com/username/foo
but i'm not happy with that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想要:
这会将每个请求发送到 user.php。如果您不希望这样,最好将所有内容发送到可以更好地处理事情的 php 路由脚本,例如,
然后在路由器中您可以从
$_SERVER['REQUEST_URI']
获取路径例如,You want:
This will send every request to user.php. If you don't want that it's probably better to send everything to a php routing script that can handle things a bit better e.g.,
Then in router you can get the path from
$_SERVER['REQUEST_URI']
e.g.,