0

I'm trying to redirect the page http://www.example.org/newsletter/unsubscribe.html to http://www.example.org/newsletter/unsubscribe.

I have tried the following:

add_rewrite_rule('newsletter/unsubscribe.html$', 'newsletter/unsubscribe', 'top');


If I var_dump the global wp_rewrite i see the following rule added:

  ...
  public 'non_wp_rules' => 
    array (size=1)
      'newsletter/unsubscribe.html$' => string 'newsletter/unsubscribe' (length=20)
  ...

Does anyone know what I am missing?

1
  • Do you want to perform a redirection or rewrite the URL? They are different things.
    – cybmeta
    Commented Jan 28, 2015 at 16:14

1 Answer 1

1

The short answer is: that's not how rewrite rules work. You can see how they work in the examples section of the codex page.

It sounds like what you're trying to do is setup a redirect. I would suggest using a plugin to do that.

1
  • Thanks, got it working now with add_rewrite_rule('newsletter/unsubscribe.html$', 'index.php?page_id=234300', 'top');
    – pbaldauf
    Commented Jan 29, 2015 at 7:17

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.