2017-03-09 104 views
0

如何将包含value=123something的所有URL重定向到/maintenance.php.htaccess;如何重定向所有包含特定参数的子目录

重定向例如: -

www.example.com/something/myfile.php?value=123 
www.example.com/something/thisfile.php?value=123 

不要例如重定向

www.example.com/something/myfile.php?value=999 
www.example.com/something/myfile.php?test=999 
www.example.com/folder/myfile.php?value=123 

我该怎么做.htacces

回答

1

您可以使用此重定向规则,以匹配特定URI与特定QUERY_STRING

RewriteEngine On 

RewriteCond %{THE_REQUEST} \s/+something/[^?]*\?value=123[&\s] [NC] 
RewriteRule^/maintenance.php? [R=302,L] 
+1

谢谢合作! – David

相关问题