1
我有一個問題,而使用的.htaccess重定向:維護HTTP方法類型,同時重定向
....
RewriteCond %{REQUEST_METHOD} ^GET
RewriteRule ^retweet/(.*)$ /test.php?method=get&path=$1
RewriteCond %{REQUEST_METHOD} ^PUT
RewriteRule ^retweet/(.*)$ /test.php?method=put&path=$1
RewriteCond %{REQUEST_METHOD} ^DELETE
RewriteRule ^retweet/(.*)$ /test.php?method=delete&path=$1
RewriteCond %{REQUEST_METHOD} ^POST
RewriteRule ^retweet/(.*)$ /test.php?method=get&path=$1
RewriteRule ^retweet/(.*)$ /test.php?method=null&path=$1
事實上,以這種方式,我會永遠得到空爲匹配HTTP方法通過PHP逮住。我試着也用這個簡單的解決方案:
RewriteRule ^(.*)$ /test.php?path=$1
但是,這樣一來,它總是會返回「GET」 PHP方法。有沒有解決方法? 謝謝。
如何是關於使重定向最終以'[L]'? – Khez 2011-04-22 17:48:56
不是一個真正的php問題,刪除了php標籤並添加了mod-rewrite標籤。 – bradym 2011-04-24 02:30:29