2012-01-03 102 views

回答

1

您無法從RewriteRule指令中獲取查詢字符串。 如果要檢測var=val?(空查詢字符串)使用

#if query string has var=val 
RewriteCond %{QUERY_STRING} var=val [NC,OR] 
#or it just has ? with no query string 
RewriteCond %{THE_REQUEST} page\.php\?\ [NC] 
#and resource is page.php serve 404 
RewriteRule ^page\.php$ /404.shtml [R=404,L,NC] 
+0

它也重定向「HTTP:///www.yourdomain.com/page.php」我只是想爲「HTTP:// /www.yourdomain.com/page.php?」。如果它包含「?」在末尾 – Arif 2012-01-03 20:33:46

+0

@Arif嘗試上面的編輯 – 2012-01-03 21:06:07