Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的旧搜索文件曾经被命名为 namesearch.php。它现在被命名为 search.php。查询字符串参数保持不变。我想将任何名称搜索请求重定向到 search.php。这是我下面的内容,这是行不通的。
RewriteRule ^/namesearch.php%1 search.php$1 [R=301,L]
当目标 URI 不尝试构建自己的(即其中没有 a ?)时,会自动附加查询字符串。您可以使用 mod_rewrite 或 mod_alias:
?
mod_alias:
Redirect 301 /namesearch.php /search.php
mod_rewrite:
RewriteEngine On RewriteRule ^/?namesearch.php /search.php [L,R=301]