我试图让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提供的IISconfiguration
<?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>
任何人有任何build议lighttpd url.rewrite等价? 我所有的实验都失败了。
我正在运行lighttpd-1.4.31-1
我试过,但没有奏效。 我认为这与我没有正确模拟.htaccess中的[QS]有关
url.rewrite-once = ("^(.*)$" => "index.php?routestring=$1", "^(admincp/)$)" => "index.php?routestring=$1")
这已经让我更接近,但function尚未完善。
url.rewrite-if-not-file = ("^(.*)$" => "index.php?routestring=$1", "^(admincp/)$)" => "index.php?routestring=$1")
正则expression式应用于整个请求URI,包括查询string,因此您需要明确地处理它 。 尝试这样的事情:
url.rewrite-if-not-file = ( "^/([^\?]+)(\?(.*))?$" => "index.php?routestring=$1&$3", ) url.rewrite-once = ( "^/(admincp/[^\?]+)(\?(.*))?$" => "index.php?routestring=$1&$3", )
第二个/admincp/
可能不是必须的,因为rewrite-if-not-file
不匹配目录。