views:

29

answers:

0

Hello, I am using djano-cms for my site, but instead of language alias /en/ /de/ I need to use another domain. I would like to avoid running multiple django instances, and instead I would like to use lighttpd redirects if possible. I would like requests coming to domain2.com getting data from domain.com/en . The best would be if the user entering:

domain2.com/offer got transparently data from domain.com/en/offer

Tried many solutions with url.redirect, url.rewrite but none seems to work as desired. Also tried with: http://stackoverflow.com/questions/261904/matching-domains-with-regex-for-lighttpd-mod-evhost-www-domain-com-domain-com but that didn't work.

Please help. This is my lighttpd configuration.

$HTTP["host"] == "^domain2\.com" {
url.redirect = ("^/(.*)" => "http://domain.com/en/$1")
}

$HTTP["host"] =~ "^domain\.com" {
server.document-root = "/var/www/django/projects/domain/"
accesslog.filename = "/var/log/lighttpd/domain.log-access.log"
server.errorlog = "/var/log/lighttpd/www.domain-error.log"
fastcgi.server = (

 "/domain-service.fcgi" => (
        "main" => (
            "socket" => "/tmp/django-domain.sock",
            "check-local" => "disable",
        )
    ),
)

alias.url = (
    "/media/" => "/var/www/django/projects/domain/media/",
)

url.rewrite-once = (
    "^(/site_media.*)$" => "$1",
    "^(/media.*)$" => "$1",
    "^/favicon\.ico$" => "/media/favicon.ico",
    "^(/.*)$" => "/domain-service.fcgi$1",
}

Thanks