WordPress.org

Ready to get started?Download WordPress

Forums

SEEKING: Super ReWrite Man! (13 posts)

  1. wairoanz
    Member
    Posted 9 years ago #

    I cannot figure this out. Could somebody please help me with a mod rewrite rule to make...

    http://www.xyz.com/index.php?paged=2
    become
    http://www.xyz.com/page/2/

    and...

    http://www.xyz.com/index.php?category_name=general/&paged=2
    become
    http://www.xyz.com/general/page/2

    We have html experts, css experts, php experts, wordpress experts in this community. Dearly hoping we have a mod rewrite expert hiding in the woodwork! Come in, Mr. ReWrite Man! :)

  2. TechGnome
    Moderator
    Posted 9 years ago #

    Only that's not the post ID so that isn't going to work.... what he(she?) wants to do is goto page 2 of what ever post.... I know what he is after is when using the Next/PRevious pages links, they come out all funky.... Not sure what the answer is though. Because simply setting the rewrite isn't going to do much good if the function doesn't return it in the appropriate fasion.
    TG

  3. benjamin
    Member
    Posted 9 years ago #

    Perhaps more permalink options should be available in 1.3, then.

  4. wairoanz
    Member
    Posted 9 years ago #

    Well the links "look" fine now... but clicking them leads to my 404 page... :( I'll need to switch back and scratch my head a bit longer.

  5. Beel
    Member
    Posted 9 years ago #

    Users of 1.3:
    wairoanz - I don't know what version of WP you are using but I just finished cannibalizing the plugin and letting it use WP's function for get_pagenum_link so it behaves much better. I deleted lines 13 and 14 (global stuff) and lines 19 through 32 ($qstr stuff) and changed the echoed links to:
    echo ' href="' .get_pagenum_link(1). '">'. $prelabel . 'First ... ';
    echo ' href="' .get_pagenum_link($i). '">'.$i.' ';
    echo ' ... href="' .get_pagenum_link($max_page). '">Last ' . $nxtlabel . '';
    Might as well use what is already built into WP

  6. wairoanz
    Member
    Posted 9 years ago #

    Hi Beel... I'm using WP 1.2... I'm a bit nervous about upgrading in case all the plugins (that I have finally got whipped into shape) stop working. I'm also using Root's Gemini index.php. Or do you think an upgrade would go smoothly?

  7. Beel
    Member
    Posted 9 years ago #

    Unlike Kerry, I am perfectly willing to say, "I prefer not to answer that question." I suspect get_pagenum_link is functionally the same in 1.2 - but don't know. If so, it should work fine. You can check out the links in my page - the category paging works now, too.
    Just do a backup of the page-navi and give the changes a whirl - but don't delete anything first, just do the echo substitutions above. If it works then you can start deleting what will then be irrelevant code.

  8. wairoanz
    Member
    Posted 9 years ago #

    :(
    Fatal error: Call to undefined function: get_pagenum_link() in /home/httpd/vhosts/wairoa.com/httpdocs/wp-content/plugins/page-navi.php on line 47

  9. theglobalguy
    Member
    Posted 9 years ago #

    Works like a charm! Thanks again Beel.

  10. cubal
    Member
    Posted 9 years ago #

    I'm not sure how these will work with any existing rules, but by themselves they should work
    http://www.xyz.com/index.php?paged=2 -- http://www.xyz.com/page/2/
    Needs
    RewriteRule ^page/([0-9]+)/$ /index.php?paged=$1 [QSA]
    and...
    http://www.xyz.com/index.php?category_name=general/&paged=2 -- http://www.xyz.com/general/page/2
    needs
    RewriteRule ^([a-zA-Z]+/)page/([0-9]+)$ /index.php?category_name=$1&paged=$2 [QSA]
    Like I said, I have no idea whether those will conflict with existing WP links... you may find you need to change the "page" in the first part of the rule (and in the urls) to something else. Anyway, hope that helps.

  11. wairoanz
    Member
    Posted 9 years ago #

    No luck with that, Cubal. But thanks very much for giving it a shot.

  12. divrom
    Member
    Posted 9 years ago #

    Cubal,
    That works great for the normal index page - thankyou! - but the categories rule doesn't work.
    My links are something like http://www.organicchurch.net/categories/general/ but I've tried a number of variations to your rewrite to get it to work.
    I'm also trying to get one for the listings of posts I have by different authors, which currently look like: http://www.organicchurch.net/archives/author/graham-old/
    If I'm missing something obvious, I'd love to know! :o)

  13. divrom
    Member
    Posted 9 years ago #

    Is this even possible?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.