Committer: gariev
LJSUP-8836: OMG Yandex indexationU trunk/cgi-bin/Apache/LiveJournal.pm U trunk/cgi-bin/LJ/Session.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm =================================================================== --- trunk/cgi-bin/Apache/LiveJournal.pm 2011-05-18 06:10:17 UTC (rev 19070) +++ trunk/cgi-bin/Apache/LiveJournal.pm 2011-05-18 06:55:51 UTC (rev 19071) @@ -525,7 +525,7 @@ if ($host =~ /^(?:users|community)\./) { $uri =~ s!^/[^/]+!!; } - return redir("$journal_base$uri$args_wq"); + return redir("$journal_base$uri$args_wq", LJ::Request::HTTP_MOVED_PERMANENTLY()); } } Modified: trunk/cgi-bin/LJ/Session.pm =================================================================== --- trunk/cgi-bin/LJ/Session.pm 2011-05-18 06:10:17 UTC (rev 19070) +++ trunk/cgi-bin/LJ/Session.pm 2011-05-18 06:55:51 UTC (rev 19071) @@ -659,6 +659,14 @@ my $no_session = sub { my $reason = shift; + + ## hack: don't redirect crawlers (yandex crawlers, actually) to get_domain_session.bml + ## otherwise, sites like 'omgadget.ru' are not indexed by yandex + my $ua = LJ::Request->header_in('User-Agent'); + if ($ua && $ua =~ m!http://yandex\.com/bots!i) { + return undef; + } + my $rr = $opts->{redirect_ref}; if ($rr) { $$rr = "$LJ::SITEROOT/misc/get_domain_session.bml?ljpta=1&return=" . LJ::eurl(_current_url());