• Resolved jaco.thiart

    (@jacothiart)


    Hi WordPress Support,

    Wordpress Rewrite Rules sometimes write incorrecty to options table option_key “rewrite_rules”

    It replaces the page redirect rule from, “/([^/]+)/?$” to “([^/]+)/?$”, discarding the pre forward slash, causing the pages to render the blogs on website instead of the page itself.

    I wrote a workaround to solve this.

    Can you please let us know if this is a core bug, and when it can be resolved?

    Kind Regards

    • This topic was modified 3 years, 8 months ago by jaco.thiart.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator threadi

    (@threadi)

    Sounds interesting. Do you have a concrete example that can be used to illustrate this?

    Thread Starter jaco.thiart

    (@jacothiart)

    Hi @threadi

    We are trying to solve the problem on a website for one of our clients

    <client website>/about-us sometimes after some hours shows the blog page instead of the about page.

    I took 2 snapshots of database before and after this occurrence.

    After several hours of code reading I managed to compare the option_name “rewrite_rules” on the before and after database table _options and note that the pre character “/” was missing in that particular rewrite rule.

    Then I wrote a filter function to capture the incorrect rule index, and replace it with the correct index on filter “rewrite_rules_array”

    Then all the pages shows up again, and all client website links to pages loads again.

    Please let us know what could be the cause of this?

    Kind Regards,

    @jacothiart

    Moderator threadi

    (@threadi)

    How does the entry for this URL get into the rewrite_rules? Is that a fixed entry? That would be unusual and not WordPress standard. It would therefore be interesting to know what kind of URL this is and what it belongs to?

    Thread Starter jaco.thiart

    (@jacothiart)

    URLs can be flushed in WordPress, in order for other plugins to add to those rewrites in options table which are dynamically collected and populated by built in functions or plugin actions.

    But this rewrite “/([^/]+)/?$”, the correct one, with pre “/” is related to WordPress page loading

    Moderator threadi

    (@threadi)

    Unfortunately, I can no longer follow. What does this rule have to do with the page URL you are concerned with?

    Again: could you please show a concrete example that makes your problem reproducible? I would like a description of what you see as the cause of the problematic URL and with what concrete code you have solved it for yourself. It’s best to describe it in such a way that it can be reproduced in a clean installation. You should use a WordPress installation without any plugins and with a standard theme as a basis, just like someone who wants to understand it. This way, what you describe would be reproducible if necessary.

    Thread Starter jaco.thiart

    (@jacothiart)

    Hi @threadi

    The information is confidential, is there an email I can send the information to for assistance that is not on a public forum.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    The information is confidential, is there an email I can send the information to for assistance that is not on a public forum.

    @jacothiart I’m sorry, but that option does not exist and please do not ask for anyone to contact you off forum. These are 100% volunteer community forums and no one should be contacting you off forum or accept an offer for you to contact them.

    If anyone does contact you, please let us know. There are lot of work spammers and please do not accept any off forum contact. That has ended badly for users in the past.

    If you cannot post the link then that is fine but it will make it harder for volunteers to help you.

    If you do post a link, please be aware that it will NOT be deleted later and any short links posted will be expanded when found.

    Thread Starter jaco.thiart

    (@jacothiart)

    Hi @jdembowski

    Understood

    Thank you for the information on not contacting others on the forum

    Thread Starter jaco.thiart

    (@jacothiart)

    Hi @threadi

    “””
    Unfortunately, I can no longer follow. What does this rule have to do with the page URL you are concerned with?
    “””

    The rule is in an order of index to apply to loading of all URLs on WordPress.

    The rule I mentioned is specifically for post type “page”

    Thread Starter jaco.thiart

    (@jacothiart)

    Hi WordPress Support,

    We manage to resolve our issue, issue was another plugin causing all this trouble.

    This plugin was not related to WordPress core.

    The other plugin inserted a rewrite rule that broke pages rewrite rules defaulting to blog.

    Keep up the great work, WordPress Team.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘WordPress Rewrite Rules incorrect during website loads’ is closed to new replies.