Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r19071: LJSUP-8836: OMG Yandex indexation

Committer: gariev
LJSUP-8836: OMG Yandex indexation

U   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());

Tags: gariev, livejournal, pm
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments