htaccess 隐藏部分查询字符串
这是我的问题。
我想重写
它
www.domain.com/?cur=artist/profile&id=1&title=username -apache 读取的实际 url
www.domain.com/?cur=artist/profile&id=1&title=username - apache 读取到的
www.domain.com/username - 重写后并显示在浏览器链接上
其想法类似于 facebook
https://www.facebook.com/profile.php?id=123456789012345< /a> -在帐户设置中设置用户名之前
https://www.facebook.com/username - 设置用户名后
但就我而言,我的用户名位于查询字符串中。因此,我只需要从查询字符串 n 中删除 ?cur=artist/profile&id=1&title=
,仅留下 username
。
here is my issue.
i want to rewrite it
from
www.domain.com/?cur=artist/profile&id=1&title=username -actual url that apache read
to
www.domain.com/username -after rewrite and appear on browser link
the idea is similar to facebook
https://www.facebook.com/profile.php?id=123456789012345 -before set username on account setting
https://www.facebook.com/username -after set username
but in my case, i have my username on the query string. therefore, i just need to remove ?cur=artist/profile&id=1&title=
from query string n left username
only.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能直接使用
RewriteRule
来做到这一点,您需要使用RewriteCond
。好吧,这里有两个:一个用于请求,另一个用于查询字符串。如果
var_a
位于开头,则以下示例将有效 - 如果不是,则正则表达式将更加复杂。如果您需要更完整的答案,请完成您的问题:You cannot do that using a
RewriteRule
directly, you need to use aRewriteCond
. Well, two, here: one for the request, the other for the query string.The following example will work, provided that
var_a
is at the beginning -- if it isn't, the regex will be more complicated. If you need a more complete answer, please complete your question: