1

I'm trying to set up some external redirects, but it seems like they are not being added to htacccess even tho it's supposed to (I think).

add_rewrite_rule('^dashboard\/([^.]+\.(jpe?g|gif|bmp|png))$', ZPB_P_PATH_URI . '/inc/dashboard/dist/$matches[1]', 'top');

I know that it's supposed to work because I did it in the past on another Wordpress, but the only thing that differs is that the site is a multisite, and I'm wondering if I miss something

I tried to call save_mod_rewrite_rules() but it's seems to be undefined.

[EDIT]

So after checking the content of save_mod_rewrite_rules() there is a check if the site is a multisite:

if ( is_multisite() ) {
    return;
}

So for now I don't know how to handle this, I really need a way to control htaccess because the htaccess isn't in our git, so the only way I can do it is to copy a small portion of the function that handles the writing process in htaccess and include it in my code :/

If someone has an idea ...

1 Answer 1

1

Rewrite rules are not added to htaccess by default: they are recorded in the options table, under the option name rewrite_rules. That option is checked every time WP runs parse_request.

If your rewrites aren't working as expected I'd look elsewhere for the cause (incorrect regex, rules in wrong order, rules being added too late etc).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.