2017-03-09 103 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

相關問題