• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Problem with rewriting (on lighttpd)

F

flux

Guest
#1
Hello,

we have some problems with our Xenforo system on lighttpd:

Tere is an index.html showing an image rooster in
  • /var/www/domain.com/public_html/

and XenForo installed to
  • /var/www/domain.com/public_html/community/

Lighttpd's virtual host for domain.com ist configured as follows (only way to get it working anyway):

Code:
$HTTP["host"] =~ "domain.com" {

    server.document-root = "/var/www/domain.com/public_html/community/"
    server.dir-listing = "disable"
    dir-listing.hide-dotfiles = "enable"

    url.rewrite = (
        "^/(data|install|js|styles)/(.*)$" => "$0",
        "^/(.*\.php)(.*)$" => "$0",
        "^/.*(\?.*)" => "/index.php$1",
        "" => "/index.php"
    )
}
The problem is, that if we remove "community/" from the server.document-root var, the rewrite does not work and the index.html not, too. Lighttpd tries to call an index.php in the public_html folder directly, which is not there.

What shall we do, to fix this problem.

I've already tried to put the rewrite rule in to
Code:
HTTP["url"]="^/community/"
which isn't working too.

Someone in the lighttpd forums posted this:
Code:
$HTTP["host"] =~ "domain.com" {
    server.document-root = "/var/www/domainname/public_html/"
    server.dir-listing = "disable"
    dir-listing.hide-dotfiles = "enable"

    url.rewrite = (
        "^/community/(data|install|js|styles)/(.*)$" => "$0",
        "^/community/(.*\.php)(.*)$" => "$0",
        "^/community/.*(\?.*)" => "/community/index.php$1",
        "^/community" => "/community/index.php"
    )
}
which isn't working also.

Any suggestions/ideas?
 

Jake Bunce

XenForo moderator
Staff member
#2
HTTP["url"]="^/community/"
Try this:

Code:
HTTP["url"] =~ "^/community/"
For reference:

http://redmine.lighttpd.net/wiki/1/MigratingFromApache
http://redmine.lighttpd.net/wiki/lighttpd/Docs:Configuration

<operator> is one of:
Operator Value
== string equal match
!= string not equal match
=~ perl style regular expression match
!~ perl style regular expression not match
(I don't have a lighttpd server to test this, I am just reading documentation)
 
F

flux

Guest
#3
It's been fixed (for a while now). The rewrite rule was correct, but for some case not working. I restarted the webserver several times - which did not apply the changes. force-reload then worked :)