Mod-Rewrite
vBulletin 5 + lighttpd url 重寫
我正在嘗試啟動 vBulletin 5 並在 lighttpd 下執行,但我在 url 重寫方面遇到了一些問題。這是 vBulletin 提供的 apache .htaccess。
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA] #needed because admincp is an actual directory. RewriteRule ^(admincp/)$ index.php?routestring=$1 [L,QSA] </IfModule>
如果這有幫助,這是 vBulletin 提供的 IIS 配置
<?xml version="1.0" encoding="UTF-8"?> <!-- This file is to support redirection in IIS. It is harmless if you are running under Apache --> <configuration> <system.webServer> <rewrite> <rules> <rule name="Main Redirect" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:1}" /> </rule> <rule name="Admincp" stopProcessing="true"> <match url="^(admincp/)$" ignoreCase="false" /> <action type="Rewrite" url="index.php/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
有人對 lighttpd url.rewrite 等效項有任何建議嗎?到目前為止,我所有的實驗都失敗了。
我正在執行 lighttpd-1.4.31-1
我試過這個,但沒有用。我認為這與我沒有正確模仿有關
$$ QS $$在.htaccess
url.rewrite-once = ("^(.*)$" => "index.php?routestring=$1", "^(admincp/)$)" => "index.php?routestring=$1")
這讓我更接近但還沒有完全發揮作用。
url.rewrite-if-not-file = ("^(.*)$" => "index.php?routestring=$1", "^(admincp/)$)" => "index.php?routestring=$1")
正則表達式應用於整個請求 URI,包括查詢字元串,因此需要顯式處理。嘗試這樣的事情:
url.rewrite-if-not-file = ( "^/([^\?]+)(\?(.*))?$" => "index.php?routestring=$1&$3", ) url.rewrite-once = ( "^/(admincp/[^\?]+)(\?(.*))?$" => "index.php?routestring=$1&$3", )
第二個 for
/admincp/
可能沒有必要,因為rewrite-if-not-file
與目錄不匹配。