重写单个 url 帮助
我正在尝试将以下 url: 重写
index.php?route=checkout/cart
为
/cart
using:
RewriteRule ^index.php?route=checkout/cart$ /basket [L]
但它似乎不起作用。有人知道我做错了什么吗?
谢谢
I'm trying to rewrite the following url:
index.php?route=checkout/cart
to
/cart
using:
RewriteRule ^index.php?route=checkout/cart$ /basket [L]
However it doesn't seem to work. Anyone know what I'm doing wrong?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
RewriteRule
仅测试URL 路径。您需要RewriteCond
进行测试查询:附加的
R=301
标志将导致状态代码为 301(永久重定向)的外部重定向,而不是内部重定向。如果你想反过来:
RewriteRule
does only test the URL path. You needRewriteCond
to test the query:The additional
R=301
flag will cause an external redirect with the status code 301 (permanent redirect) instead of an internal redirect.And if you want the other way round:
您需要发送重定向,以便新 URL 反映在浏览器地址栏中。因此,将
R
添加到[L]
中。如果您希望搜索机器人忽略“丑陋”的 URL 和/或将其从索引中删除并使用新的,则发送
301
重定向。You need to send a redirect so that the new URL get reflected in browser address bar. So, add
R
to the[L]
.If you'd like that searchbots should ignore the "ugly" URL and/or remove it from the indexes and use the new instead, then send a
301
redirect.