• Resolved wreciak

    (@wreciak)


    Hi All
    Quite strange problem.
    I have a webpage with polylang – 5 languages, everything works quite well, just google cannot fetch site. Google ignore all 302 files, and i believe polylang is using this kind of redirection. It means, google bot just cannot index hole page.

    Is here somebody with the same experience? Any idea how to configure .htaccess to use 301 redirection, not 302? 301 is accepted by google …
    Thanks a lot and have a nice day
    Martin

    Some details for troubleshooting:
    http://www.les-casetes.com

    .htaccess
    addhandler x-httpd-php-cgi .php4
    addhandler x-httpd-php5-cgi .php5
    
       # turn on the module for this directory
    ExpiresActive on
        # set default
    ExpiresDefault "access plus 24 hours"
    ExpiresByType image/jpg "access plus 1 months"
    ExpiresByType image/gif "access plus 1 months"
    ExpiresByType image/jpeg "access plus 1 months"
    ExpiresByType image/png "access plus 1 months"
    ExpiresByType text/css "access plus 1 months"
    ExpiresByType text/javascript "access plus 1 months"
    ExpiresByType application/javascript "access plus 1 months"
    ExpiresByType application/x-shockwave-flash "access plus 1 months"
    # BEGIN WPSuperCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
    AddDefaultCharset UTF-8
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{HTTPS} on
    RewriteCond %{DOCUMENT_ROOT}/home/content/19/9732119/html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -f
    RewriteRule ^(.*) "/home/content/19/9732119/html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz" [L]
    
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{HTTPS} !on
    RewriteCond %{DOCUMENT_ROOT}/home/content/19/9732119/html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f
    RewriteRule ^(.*) "/home/content/19/9732119/html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]
    
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTPS} on
    RewriteCond %{DOCUMENT_ROOT}/home/content/19/9732119/html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f
    RewriteRule ^(.*) "/home/content/19/9732119/html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html" [L]
    
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTPS} !on
    RewriteCond %{DOCUMENT_ROOT}/home/content/19/9732119/html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
    RewriteRule ^(.*) "/home/content/19/9732119/html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]
    </IfModule>
    
    # END WPSuperCache
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    [ Please place large code blocks in back ticks ]

    http://wordpress.org/extend/plugins/polylang/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Chouby

    (@chouby)

    You chose not to hide the language code for the default language. This means that the link you provided has no content. That’s why Polylang makes a redirection. This is a 302 because the redirection is dependent on the user.

    Thread Starter wreciak

    (@wreciak)

    hi
    Thanks for explanation, but no luck. I tried all combination of the settings, switch off all the cache plugins and even tried to force links to keep actual language but i’m getting still 302 moved temporarily. If i deactivate polylang, google fetch bot can see the page normally.

    Any other tip, please? Thanks a lot for your effort.

    Martin

    Plugin Author Chouby

    (@chouby)

    The redirection done by Polylang uses the WordPress function wp_redirect. So you can always use the filter ‘wp_redirect_status’ to modify the status. For example, you can add this code in a personal plugin.

    add_filter ('wp_redirect_status', 'modify_status', 10, 2);
    function modify_status($status, $location) {
      $homepages = array(
        http://www.les-casetes.com/language/de/,
        http://www.les-casetes.com/language/es/,
      );
    
      if (in_array($location, $homepages))
        return 301;
    }
    Thread Starter wreciak

    (@wreciak)

    Hi
    Thanks for your help, it was working.. for a while.
    The problematic is only the first homepage, as polylang decide which language will use as a first one and serve this, but the link stay without language in it. For example in my case it will be les-ceaeetes.com, but the page already served is les-http://www.les-casetes.com/startseite/ or http://www.les-casetes.com/inicio/, just the link don’t appeat. And this special case is not covered byΒ filter.
    Actually, i realize that all others pages are fetched correctly (when you click later) as the menu links are correct and there is no 302 redirection anymore. Jus that first one is pity, as it is the first think google want to see ….

    However thanks a lot for you help
    Martin

    Plugin Author Chouby

    (@chouby)

    Which result would you obtain ?
    Maybe the best would be to check the option “Hide URL language information for default language” and uncheck “When the front page is visited, set the language according to the browser preference” in the Polylang settings. Thus les-ceaeetes.com would point to an unique language.

    Hey Guys,

    I am having the exact same problem with Polylang redirection and Google referencing.

    Google Web Master returns HTTP/1.1 302 on http://www.mysite.com while http://www.mysite.com/en/product returns HTTP/1.1 200,
    http://www.mysite.com/fr/product returns HTTP/1.1 200.

    It seems your recommendation to use the filter ‘wp_redirect_status’ could solve my issue as well but can’t determine from the last posts if it really works.

    Question is: does this solution really work? Will it work with future versions of Polylang and WordPress? Is this the way to go?

    Thanks in advance,

    Mike.

    Plugin Author Chouby

    (@chouby)

    The problem is that I don’t understand what is the issue with this redirection.

    Problem with 302 redirection is SEO referencing, having a 302 lower your score.
    Temporary redirection is an issue when it comes to good referencing.

    Anyways, after several attempts, We went to .htaccess browser language driven 301 redirection. It’s not perfect but that removes the plugin 302 redirection with some tweaking in Polylang settings.

    Plugin Author Chouby

    (@chouby)

    Is it Google which states that 302 lowers the score?

    I investigated and looked at what is done by other multilingual plugins:
    qTranslate: 302
    WPML: I don’t have the source but Google helped me and I found this: http://wpml.org/forums/topic/bug-redirect-by-browser-language/ and discovered that WPML authors are not sure of what to do: 301, then 300, then 300 or 307 depending on the browser

    Plugin Author Chouby

    (@chouby)

    I found this: http://googlewebmastercentral.blogspot.fr/2010/03/working-with-multilingual-websites.html
    In which you can read:

    To make all of your site’s content more crawlable, avoid automatic redirections based on the user’s perceived language. These redirections could prevent users (and search engines) from viewing all the versions of your site.

    So it seems that Google does not like automatic redirection (whatever the status used…).
    As mentioned above, check “Hide URL language information for default language” and uncheck “When the front page is visited, set the language according to the browser preference” and there should be no more redirection.

    Thread Starter wreciak

    (@wreciak)

    Thanks a lot, it is working now.
    Your support is more then great πŸ™‚ just that auto redirect based on the language browser setup is the functionality nice to have .. however, google is more important in this case.
    Have a nice day

    Martin

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘302 page moved – google cannot fetch webpage with polylang’ is closed to new replies.