.htaccess 301 重定向示例 /old-page/?utm_source=twitter.com 到 /new-folder/new-page/?utm_source=twitter.com

.htaccess 301 redirect example /old-page/?utm_source=twitter.com to /new-folder/new-page/?utm_source=twitter.com

研究这个已经有一段时间了。我如何将旧页面及其文件夹结构重定向到新页面及其文件夹结构,最后 URL 中的所有内容都完好无损?类似于:

RedirectMatch 301 /old-page/(.*) /new-folder/new-page/

RewriteRule ^old-page/(.*) /new-folder/new-page/ [L,R]

L 标志告诉 Apache 它是为任何匹配执行的最后一条规则。 R 标志默认使用 302 进行重定向;如果您想要不同的重定向类型,例如使用 [L,R=301]