stratogratte (stratogratte) wrote in lj_dev,



I have tried to get help on lj_everywhere but no one seems to know how to fix this. So I ask here.

I am searching a way go get the $OTHER_VHOSTS feature that lets the users use their proper domain name with their journal work.

BUT, when I activate this, all the pages of my lj-site get
404-errors. I have searching in the archives of lj_everywhere and lj_dev
and I have seen several people getting the exactly same problem but who
didn't found any solution to this problem.

So, I have searched what is the part of the code that manage this and I
have found that it is /cgi-bin/Apache/ who manage this through this

I suppose there is a special modification to make this work? As LiveJournal use it without any problem?

Thanks to help me/us ^^

 # user domains

    if ($LJ::USER_VHOSTS &&

        $host =~ /^([\w\-]{1,15})\.\Q$LJ::USER_DOMAIN\E$/ &&

        $1 ne "www" &&

        # 1xx: info, 2xx: success, 3xx: redirect, 4xx: client err, 5xx: server err

        # let the main server handle any errors

        $r->status < 400)


        my $user = $1;

        # see if the "user" is really functional code

        my $func = $LJ::SUBDOMAIN_FUNCTION{$user};

        if ($func eq "normal") {

site admin wants this domain to be ignored and treated as if it

were "www", so set this flag so the custom "OTHER_VHOSTS" check

            # below fails.

            $skip_domain_checks = 1;

        } elsif ($func) {

            my $code = {

                'userpics' => \&userpic_trans,

                'files' => \&files_trans,


            return $code->{$func}->($r) if $code->{$func};

            return 404;  # bogus ljconfig

        } else {

            my $view = $determine_view->($user, "users", $uri);

            return $view if defined $view;

            return 404;



    # custom used-specified domains

    if ($LJ::OTHER_VHOSTS && !$skip_domain_checks &&

        $host ne $LJ::DOMAIN_WEB &&

        $host ne $LJ::DOMAIN && $host =~ /\./ &&

        $host =~ /[^\d\.]/)


        my $dbr = LJ::get_db_reader();

        my $checkhost = lc($host);

        $checkhost =~ s/^www\.//i;

        $checkhost = $dbr->quote($checkhost);

        # FIXME: memcache this?

        my $user = $dbr->selectrow_array(qq{

            SELECT u.user FROM useridmap u, domains d WHERE

            u.userid=d.userid AND d.domain=$checkhost


        return 404 unless $user;

        my $view = $determine_view->($user, "other:$host$hostport", $uri);

        return $view if defined $view;

        return 404;



  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded