Sreenath T.V ([personal profile] scamper) wrote in [site community profile] dw_dev_training2010-06-13 04:09 pm
Entry tags:

Bug-1059

I have been working on bug-1059,i.ebugs.dwscoalition.org/show_bug.cgi . I submitted a patch on 2.06.2010. But there was some problem with that. It failed to redirect shop.dreamwidth.org/<something> to dreamwidth.org/shop/<something>. Now I am trying to fix this. I made an entry in the %LJ::SUBDOMAIN_FUNCTION defined in the /etc/config.pl similar to the one which is done for cssproxy. Then in dw/cgi-bin/Apache/LiveJournal.pm, I entered this code, 

        } elsif ($func eq 'support') {
            return redir($r, "$LJ::SITEROOT/support/");
 
        } elsif ($func eq "shop") {
            if($host =~ m!^(\w|\.)+/([\w\-]{1,25})$!) {
                return redir($r, "$LJ::SITEROOT/shop/$2");
            } else {
                return redir($r, "$LJ::SITEROOT/shop");
            }
 
        } elsif (ref $func eq "ARRAY" && $func->[0] eq "changehost") {
  
I understood that this is not correct, But my intention was that in this case, $1 will contain shop.dreamwidth.org and $2 will contain <something> and this is not working, instead it is redirecting both shop.dreamwidth.org and shop.dreamwidth.org/something to dreamwidth.org/shop. I'm not sure what I have done is correct. Please give some suggestions so that I can make it work. I could very well be wrong. 
exor674: Computer Science is my girlfriend (Default)

[personal profile] exor674 2010-06-13 01:31 pm (UTC)(link)
$host is just the hostname, you want $uri ( which wound be "/" or "/something" )