如何删除查询字符串?
注意:我不太会说英语
,我对 mod_rewrite
有疑问。
我想替换我的网站名称,我希望将此 URL
http://www.oldsite.com/index.php?v=contact
重写为 URL
http://www.newsite.com/page/contact with 301 rewrite.
我正在这样做:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{QUERY_STRING} v=contact
RewriteRule ^index.php http://www.newsite.net/page/contact [R=301,L]
但我收到查询 http://www.newsite.net/page/contact?v=contact
。 我不需要 ?v=contact
,我想要 http://www.newsite.net/page/contact
。
Note: i little speak english
I have a problem with mod_rewrite
.
I want to replace my site name, I want this URL
http://www.oldsite.com/index.php?v=contact
rewritten to URL
http://www.newsite.com/page/contact with 301 rewrite.
I'm doing it this way:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{QUERY_STRING} v=contact
RewriteRule ^index.php http://www.newsite.net/page/contact [R=301,L]
But I'm getting the query http://www.newsite.net/page/contact?v=contact
.
I dont want ?v=contact
, I want http://www.newsite.net/page/contact
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自文档:
所以你可能应该有:
From the documentation:
So you should probably have:
根据这篇文章,您应该能够编写:
According to this article, you should be able to write: