• Resolved fgirard

    (@fgirard)


    Hi there,

    First of all, congrats for this great plugin. I have been using polylang 1.7.12 for quite a while now on wformation.com and it has been working great. However, I had been facing sporadic 404s issues on my site for pages that exist and I just was able to pinpoint it to polylang today. If I run a loadtest with polylang enabled, I get 7 404s out of 64 requests in a 5 mins test. If I run the same test wiht polylang disabled, no 404s… I am running On Ubuntu 14.04.3 and Apache 2.4.7 and MariaDB 5.5.47.

    Any help would be greatly apreciated as I up against a wall right now.

    Thanks!

    https://ww.wp.xz.cn/plugins/polylang/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Support Chrystl

    (@chrystl)

    Hi
    Could you please provide a link to your site? Which pages give a 404?

    Thread Starter fgirard

    (@fgirard)

    Hi Chrystl, here is a link that gives me sporadic 404s :
    http://www.wformation.com/course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/

    Also, not sure how it will display, but here a 8 http requests for it from our access logs.. 2 of them are 404s with no difference whatsoever in the request.. it is even the same referrer…

    45989073 104.208.160.27 – – [15/Jan/2016:01:55:07 +0000] “GET /course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ HTTP/1.1” 200 15457 “http://www.wformation.com/fr/” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)”
    42804137 104.208.160.27 – – [15/Jan/2016:01:55:43 +0000] “GET /course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ HTTP/1.1” 200 15457 “http://www.wformation.com/fr/” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)”
    26520063 104.208.160.27 – – [15/Jan/2016:01:56:30 +0000] “GET /course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ HTTP/1.1” 404 47077 “http://www.wformation.com/fr/” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)”
    35011827 104.208.160.27 – – [15/Jan/2016:01:56:49 +0000] “GET /course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ HTTP/1.1” 200 15458 “http://www.wformation.com/fr/” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)”
    38174933 104.208.160.27 – – [15/Jan/2016:01:56:49 +0000] “GET /course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ HTTP/1.1” 200 15458 “http://www.wformation.com/fr/” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)”
    38880486 104.208.160.27 – – [15/Jan/2016:01:56:58 +0000] “GET /course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ HTTP/1.1” 200 15457 “http://www.wformation.com/fr/” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)”
    38160333 104.208.160.27 – – [15/Jan/2016:01:56:59 +0000] “GET /course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ HTTP/1.1” 200 15457 “http://www.wformation.com/fr/” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)”
    19023462 104.208.160.27 – – [15/Jan/2016:01:57:23 +0000] “GET /course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ HTTP/1.1” 404 8700 “http://www.wformation.com/fr/” “Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)”

    Thread Starter fgirard

    (@fgirard)

    Also, thought that this info could be useful:

    PHP Version : 5.5.9-1ubuntu4.14 / 64Bit OS
    Memory limit : 256 MB
    Memory usage : 27.81 MB

    Plugin Support Chrystl

    (@chrystl)

    The ‘fr’ looks strange in “GET /course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ HTTP/1.1” 200 15457 “http://www.wformation.com/fr/“, since you have hidden the default language.

    Which plugin give this: /#.VpkKIl7OWR4/ ? (http://www.wformation.com/course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/#.VpkKIl7OWR4)

    Could you deactivate Polylang and see if the problem is still there?

    Thread Starter fgirard

    (@fgirard)

    Hi Chrystl,

    We are not hidding the default language.. Here is a screenshot of our polylang options -> http://www.wformation.com/wp-content/uploads/2016/01/options.png

    If we deactivate polylang, the problem goes away. I believe that it is the Academy theme that is adding the nonce code to the url, I am looking through the code as we speak to confirm it.

    Thanks for looking into this.

    Fred

    Thread Starter fgirard

    (@fgirard)

    Hi Chrystl,

    #.VpkKIl7OWR4/ was actually not a noonce code, but a tracking url code used by the AddThis plugin. I removed the below 2 lines from one of my php file and the code is no longer showing, thanks for pointing this out! However, the 404s are still happening without that code…

    <script type="text/javascript">var addthis_config = {"data_track_addressbar": true};</script>
                <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-53449bcc28225d70"></script>
                <!-- AddThis Button END -->
    Plugin Support Chrystl

    (@chrystl)

    Did you create a /fr/ folder?

    Thread Starter fgirard

    (@fgirard)

    No

    Thread Starter fgirard

    (@fgirard)

    Hi Chrystl,

    Could it be that some of the Polylang filters / action do not always get triggered at the same time.. ie.. if the priority is not set right, could it be that sometimes, it gets triggered out of sequence with something else using that filter/action? That would be the only thing that makes sense to me… Do you have any suggestions as to where/what debug logs I could put to help troubleshoot this?

    Please advise and thanks for your help.

    Thread Starter fgirard

    (@fgirard)

    Alright,I have more info. I temporarily altered class-wp.php to dump the rewrite rules when there is a 404 (handle_404 method). The issue is that the post type is not translated in the rewrite rules..

    When we get a 404, we have the below in the rewrite rules (sorry for the repeated rule0, forgot to increment the counter :S and was too lazy to do it again πŸ˜‰ ):
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/attachment/([^/]+)/?$ rewrite: index.php?attachment=$matches[1]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/attachment/([^/]+)/trackback/?$ rewrite: index.php?attachment=$matches[1]&tb=1
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ rewrite: index.php?attachment=$matches[1]&feed=$matches[2]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ rewrite: index.php?attachment=$matches[1]&feed=$matches[2]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$ rewrite: index.php?attachment=$matches[1]&cpage=$matches[2]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/([^/]+)/trackback/?$ rewrite: index.php?course=$matches[1]&tb=1
    [18-Jan-2016 06:30:32 UTC] rule0: cours/([^/]+)/page/?([0-9]{1,})/?$ rewrite: index.php?course=$matches[1]&paged=$matches[2]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/([^/]+)/comment-page-([0-9]{1,})/?$ rewrite: index.php?course=$matches[1]&cpage=$matches[2]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/([^/]+)/wc-api(/(.*))?/?$ rewrite: index.php?course=$matches[1]&wc-api=$matches[3]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/([^/]+)/wc-api(/(.*))?/?$ rewrite: index.php?attachment=$matches[1]&wc-api=$matches[3]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/attachment/([^/]+)/wc-api(/(.*))?/?$ rewrite: index.php?attachment=$matches[1]&wc-api=$matches[3]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/([^/]+)(/[0-9]+)?/?$ rewrite: index.php?course=$matches[1]&page=$matches[2]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/([^/]+)/?$ rewrite: index.php?attachment=$matches[1]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/([^/]+)/trackback/?$ rewrite: index.php?attachment=$matches[1]&tb=1
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ rewrite: index.php?attachment=$matches[1]&feed=$matches[2]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ rewrite: index.php?attachment=$matches[1]&feed=$matches[2]
    [18-Jan-2016 06:30:32 UTC] rule0: cours/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$ rewrite: index.php?attachment=$matches[1]&cpage=$matches[2]

    Where the rule is “cours”, it should say “course”.. I really think that the translation part is not forced to happen in the proper sequence…

    Any ideas?

    Thanks, Fred

    Plugin Support Chrystl

    (@chrystl)

    Polylang doesn’t handle the translation of ‘cours’. Where do you enter ‘cours’? You should replace it by ‘course’ as it’s the name of your custom post type.

    Thread Starter fgirard

    (@fgirard)

    Hi there, I removed the translation of course to cours from the PO file and it seemed to have done the trick. I no longer have 404s. However, I feel a little dirty leaving this like that not knowing exactly why it gives random 404s only when PolyLang is activated… When polylang is not activated, my links are generated as http://www.wformation.com/cours/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/ and when Polylang is activated, they are generated as http://www.wformation.com/course/apprenez-a-creer-vos-tisanes-therapeutiques-ebook/.

    So it seemes that PolyLang is preventing the post types from being translated in the links and rewrite rules, but that it randomly fails doing so.

    Plugin Support Chrystl

    (@chrystl)

    You have 2 problems:
    * you have certainly a plugin which flushes rewrite rules at each request. This is a bad practice, see codex: https://codex.ww.wp.xz.cn/Function_Reference/flush_rewrite_rules

    * the translated slug is function of the language loaded when rules are flushed.
    These 2 mixed problems are the cause of your 404 errors which seem random.

    The translation of the slug must be handled by the multilingual plugin and not by the po file (which works in monolingual website). Unfortunately Polylang doesn’t handle the slug translation.

    You must remove the slug translation, and remove the flush rewrite rules at each page.

    Thread Starter fgirard

    (@fgirard)

    Thanks a lot for your help Chrystl, appreciate it. I will look that those rewrite rules refreshes.

    Thanks again!

    Fred

    Thread Starter fgirard

    (@fgirard)

    Marking this as resolved

Viewing 15 replies - 1 through 15 (of 16 total)

The topic ‘Random 404 with polylang’ is closed to new replies.