【发布时间】:2022-01-13 00:09:16
【问题描述】:
我需要将所有小节重定向到新的 URL 作为 .htaccess 中的重写规则。
示例:
-
example.com/section=>example.com/new_section -
example.com/section/subsection1=>example.com/new_section -
example.com/section/subsection1/subsubsection=>example.com/new_section
等(每个部分都有很多小节和规则从所有部分/小节有数百条规则)
我已经重写了:
RewriteRule ^section[/]?$ /new_section [R=301,L]
此重定向仅将 URL www.example.com/section 重定向到 www.example.com/new_section,但不重定向 www.example.com/section/subsection1 等。
【问题讨论】:
标签: apache .htaccess mod-rewrite