【发布时间】:2014-11-19 06:13:39
【问题描述】:
你好,很棒的人..
我有 81 个重定向要添加到具有查询字符串的 .htaccess 中,但我不知道如何执行此操作。我想出了如何为一页执行此操作,但是您如何为具有相似性的文件夹和查询字符串执行此操作?我已在 DPI 中添加以删除新 URL 中的问号。
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^test_id=1$
RewriteRule http://domain.com/test.html? [R=301,DPI,L]
但我有 maaaaany! 大多数查询字符串是;
folder/name.php?=1
folder/name.php?=2
或
folder2/name1.php?=1
folder2/name2.php?=2
有没有一种方法可以组合查询字符串,而不是手动对所有 81 个查询字符串进行操作,以根据folder/name.php 定位它?一些查询字符串将指向相同的重定向 url,其他的则是单独的。
感谢您的帮助! 平安出来。
【问题讨论】:
标签: regex .htaccess redirect query-string url-redirection