301 重定向的 RewriteRule
我浏览了有关重写规则问题的所有已回答线程。尝试了建议,但我仍然不知道我做错了什么。
我想将旧 URL 进行 301 重定向到新 URL。示例:
old url : http://www.xyz.com/abc/topics.html
new url : http://www.xyz.com/index.php#first
我正在尝试遵循 .htaccess 中的规则:
RewriteEngine on
RewriteRule ^\/abc\/(.+)$ http://www.xyz.com/index.php#first [L,R=301]
非常感谢任何建议
I went through all the answered threads on rewrite rule problem. Tried the suggestions, But I still don't know what I am doing wrong.
I want to make a 301 redirect of our old URLs to the new ones. Example:
old url : http://www.xyz.com/abc/topics.html
new url : http://www.xyz.com/index.php#first
I am trying following rule in .htaccess:
RewriteEngine on
RewriteRule ^\/abc\/(.+)$ http://www.xyz.com/index.php#first [L,R=301]
Any advice is highly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this:
当然,您可以通过“mod_rewrite”来完成此操作,但在这种情况下,我建议您使用 mod_alias 因为它更快更简单(请参阅此 SO 响应:mod_rewrite 或 mod_alias?)
像这样:
You can, of course, do it by "mod_rewrite", but in this situation I'd suggest you use mod_alias as it is faster and simpler (see this SO response: mod_rewrite or mod_alias?)
Like this: