开发者

Converting Zend Framework default htaccess to Lighttpd

开发者 https://www.devze.com 2023-04-08 11:18 出处:网络
I\'ve been looking through the subject a couple of times, but nothing I found is quite what I need, and/or outdated as hell.

I've been looking through the subject a couple of times, but nothing I found is quite what I need, and/or outdated as hell.

I built a website using Zend Framework (and its default htaccess file), and tested it locally on MAMP, works per开发者_高级运维fectly. The live web server, unfortunately, runs on Lighttpd, which I gather does not support htaccess.

The big problem with this is that I have absolutely no experience at all with web servers, regular expressions, mod_rewrite and so on, let alone using anything else than Apache.

The default Zend Framework htaccess contains these lines:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

And I have absolutely no idea how to convert this to Lighttpd URL rewrite rules, and how/where to put them :/

Any help at all would be greatly appreciated!


Going by this documentation: http://redmine.lighttpd.net/wiki/1/Docs:ModRewrite it should be done like this:

url.rewrite-once = ( "^(/(?!(favicon.ico$|js/|images/)).*)" => "index.php" )

This basically tells your webserver to redirect everything that is NOT a file or NOT within the "js/" and "images/" folder to be redirected to the index.php

As to where you have to put this snipped of code, i'm not so familiar with lighttp myself. But i hope the snipped itself helps you enough.

For a fellow Sam! ;)


This works fine for me (specialy for ZF2):

url.rewrite-if-not-file = ("^/[^\?]*(\?.*)?$" => "index.php/$1")
0

精彩评论

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

关注公众号