【发布时间】:2015-08-10 20:29:26
【问题描述】:
这是关于使用以下永久链接的 WP 网站:
http://example.com/article/%postname%/
和“类别”的类别基础。
网站有许多带有固定链接的文章,例如:
http://example.com/article/
http://example.com/article/first-article
http://example.com/article/second-article
http://example.com/article/third-article
等等
他们工作正常,但我想重定向
http://example.com/article
致
http://example.com/
所以我编辑 htaccess 并插入以下指令:
重定向301/文章http://example.com
虽然此重定向有效,但它实际上破坏了 WP 永久链接,因为永久链接为
http://example.com/article/third-article
的文章
正在被重定向到
http://example.com/third-article,这会导致 404
我可以只将 http://example.com/article 重定向到 root 而没有其他子 url 吗?
【问题讨论】:
-
^article$添加 ^ 和 $
标签: php wordpress .htaccess mod-rewrite redirect