1
我試圖處理邏輯上簡單的操作,但Apache重寫不處理我的網站的查詢字符串請求。我聽說它最終沒有做到。仍然無法理解它的正則表達式語法。Apache重寫爲404,除了匹配的查詢
RewriteEngine on
RewriteBase/
#RewriteCond %{QUERY_STRING} ^\?category=([a-z])$ // WHY DO I NEED THIS?
RewriteRule ^!(?category=[a-z]+|?do=[a-z]+)$ [R=404,L,NC]
目標是向客戶端發送至404對任何查詢不匹配/?類別= [A-Z] +和/?做= [A-Z] +。如果可以從文本文件加載模式將會好得多。
Apache的文檔很差,Google也沒有幫助。
你好downvoter,請發表評論。 – 2012-02-09 13:44:12
現在我遇到了麻煩,允許/ js /和/ styles/RewriteCond%{PATH_INFO}!styles /([a-z0-9] +)RewriteCond%{PATH_INFO}!js /([a-z0-9] + ) – 2012-02-09 13:47:47
明白了......用REQUEST_URI – 2012-02-09 13:51:15