I have a redirect rule that is intended to load a custom template file. This worked last week, and is now not working (and loads a 404 page instead). The only change to the site is the entire site is now loaded on https instead of http.

Here is the function:

function event_rewrite() {

    add_rewrite_rule('^event/(.*)/?', 'index.php?pagename=event&event_name=$matches[1]', 'top');
add_action('init', 'event_rewrite');

Is there anything in the matching that would change with https in the url? Or is there a different problem going on that coincidentally arose when we switched to https?

1 Answer 1


This might be a permalink issue. Sometimes when things like HTTPS get turned on, you need to flush permalinks to get URL's and rewrites working again.

Head to permalinks (settings > permalinks) and just hit the save button and see if that fixes the issue there.

  • I tried that earlier, and it didn't work. I tried it again, and it worked. So, let's assume you have the golden touch. Thanks! Mar 20, 2017 at 21:22

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.