.htaccess - 如何修复此 URL 的 301 重定向
问题描述
我正在尝试转移
www.old.example/ecards/birthday-ecards/all
不再存在
https://www.new.example/static-ecards/company-birthday-ecards.html
使用.htaccess
完成此操作时,我将其重定向到
https://www.new.example/static-ecards/company-birthday-ecards.htmlecards/birthday-ecards/all
所以它将它添加到ecards/birthday-ecards/all
不需要的 URL 的末尾。
我是这个菜鸟,而不是开发人员!请指教。
我试过了
Redirect 301 "/old-folder/" "http://www.new.example/new-page.html"
Redirect 301 "/old-page.html" "http://www.new.example/new-page.html"
解决方案
old.example
在.htaccess 文件顶部添加此规则
RewriteEngine On
RewriteBase /
RewriteRule ^ecards/birthday-ecards/all$ https://www.new.example/static-ecards/company-birthday-ecards.html [R=301,L]
推荐阅读
- javascript - 如何将 Angular1 应用程序重做为 VueJs 应用程序
- javascript - 如何返回包含字符串的两个数组之间的差异
- android - 如何在android drawable中绘制下面提到的圆角形状
- sql - 如何将hascode转换为字符串值
- android - 使用 Google DevTools 调试/检查 Ionic Apk
- python - Python - 熊猫轮流爆炸行
- cassandra - Cassandra 读取负帧大小(-2062548992)!错误
- python - 使用 csv.reader 删除尾随和前导字符
- android - 如何在android中的recylerview列表项之间留出空间
- ios - 当用户在 iPhone/iPad 上的浏览器中选择图像时,套接字断开连接