开发者

Apache RewriteCond to Lighttpd

I want to migrate some sites running on apache to Lighttpd.

Can anyone help me to convert this Rewrite rule into a equivalent rule for Lighttpd:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

I'm reading the Lighttpd rewrite explanation (http://redmine.lighttpd.net/wiki/1开发者_Go百科/Docs:ModRewrite) but I didn't understand how convert this specific rule.

Thanks a lot


The Apache rules you list use RewriteCond to take any request which doesn't go to a direcotyr (!-d) and which also doesn't go to a file (!-f) and redirects it to pass the URL data into index.php as parameter "url". It makes sure to preserve any other CGI arguments (QSA) and makes no further rules match if this rule matches (L).

So http://yourserver.org/something-silly would go to http://yourserver.org/index.ph?url=something-silly and http://yourserver.org/something-silly?q=search+terms would go to http://yourserver.org/index.ph?url=something-silly&q=search-terms

Lighttpd has url.rewrite-if-not-file which partially implements this, but it will rewrite URL if it's a directory. Therefore, you'll have to add rules to specifically NOT rewrite URLs that go to known valid directories.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜