【发布时间】:2012-10-10 18:19:57
【问题描述】:
我在损坏的链接检查器网站上检查了我的 WordPress 主题,它给了我一个损坏的 URL 列表。
见:
http://www.esmedicare.com/locations.html ( parent page: http://www.esmedicare.com/ )
http://www.esmedicare.com/laser-treatments/locations.html ( parent page: http://www.esmedicare.com/laser-treatments/ )
/location.html 的链接转到 404 页面,我想将这些页面重定向到它们的父页面。即只需从 URL 中删除 /location.html 并将它们重定向到括号中提到的父 URL。
我添加了代码:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/locations.html$ /$1/ [L,R=301]
到我的 .htaccess 文件,现在一些 /location.html 页面正在重定向到它们的父页面,但仍然不是全部。
请解决我的问题...我只想删除 URL 中最后一个 /location.html。
【问题讨论】:
标签: php html wordpress .htaccess