Forums

wp_rewrite redirecting, but to incorrect page (2 posts)

  1. robothy
    Member
    Posted 2 months ago #

    Hi everyone,

    Firstly thank you for reading my post. I'm writing a plugin, which relies on mod_rewrites. After a lot of searching, I've finally managed to add my own rewrite rules to WordPress, and these are being followed - well sort of.

    I know the rules are being followed, because an URL query variable is being set, and its value echoed out in the content successfully. This is being acheived by filtering the content for the requested URI using the_content filter.

    The problem I am having is that my rule is set to redirect the page to for example:

    my-page/random => my-page?var=random

    Yet, even though the URI says I am on the my-page/random page, the content of the site homepage is displayed instead??

    I've tried amending my rewrite to read:

    my-page/random => index.php?pagename=my-page&var=random

    But this doesn't work either. Can anyone give me any pointers please?
    How can I get WordPress to render the correct page content?

    Sorry if my post is a little vague, I'm not the best at explaining things.

    Thanks in advance.

    R.

  2. robothy
    Member
    Posted 2 months ago #

    I found my solution here for anyone who is having a similar problem.
    http://wordpress.org/support/topic/223571

    When I finish building my own site, I'll be sure to post about this to save others the same hassle!

    R.

Reply

You must log in to post.

About this Topic