Support » Fixing WordPress » adding addtional rewriterule rules

  • Alright, I’m having trouble understanding the rewrite rules generated by wordpress 2.0

    http://mywebsite.com/photos/Barcelona/1/

    Now WP is installed in the base directory. photos is a page created from wordpress, that has a template page that calls a script.

    The script looks for other variables, album and pg

    index.php?pagename=photos&album=barcelona&pg=1

    This use to work for me in wordpress 1.5
    RewriteRule ^(photos)/(.+)/([0-9]{1,})/?$ index.php?pagename=$1&album=$2&pg=$3 [QSA,L]

    There are now some extra rules that end up taking me to my “Sorry, no posts matched your criteria.” page

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try putting something like this in a file named functions.php in your theme folder:

    function photos_filter($rules) {
    $rules['(photos)/(.+)/([0-9]{1,})/?$'] = 'index.php?pagename=$1&album=$2&pg=$3';
    return $rules;
    }
    add_filter('rewrite_rules_array', 'photos_filter');

    It uses one of the internal WP 2.0 rewrite rules hooks to add the rule. Your mileage may vary.

    Thank you very much, you are pimp

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘adding addtional rewriterule rules’ is closed to new replies.