• If I log into wp-admin and change my permalink structure to anything other than default, my rewrite_rules_array handler adds my rewrite rules and everything works fine. If I switch back to default, the rules stop working. I’m developing a plugin and I need these rewrite rules to work regardless of the site’s permalink structure. Any suggestions?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry, what’s the question?

    Non-permalink urls use the standard php query string format..

    url/?var=val&anothervar=anotherval&somethingelse=something

    Thread Starter cement

    (@cement)

    My code:

    add_filter(‘rewrite_rules_array’,’wp_insertMyRewriteRules’);

    function wp_insertMyRewriteRules($rules)
    {
    $newrules = array();
    $newrules[‘.*homesearch/(.+)/(.+)/(\d+).*’] = ‘index.php?hqop=sscb&hqSearchType=$matches[2]&hqSearchId=$matches[3]’;
    $newrules[‘(.+)-mlsid-(\d+).*’] = ‘index.php?hqop=listingDetail&mlsid=$matches[2]’;
    return $newrules + $rules;
    }

    after setting the permalink structure in wp-admin to default, this stops working. with any other setting, it works.

    That will happen, when you use default you’re actually telling WordPress not to use mod_rewrite, effectively disabling it’s use of mod_rewrite… (i think)…

    Set the permalinks to something other then default or add your rules above the WordPress stuff in the htaccess directly..

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom rewrite rules stop working when using default permalink settings’ is closed to new replies.