Root Relative URLs
[resolved] WordPress add_rewrite_rule not working with Root Relative URLs (3 posts)

  1. mitchell360
    Posted 3 years ago #

    When using this plugin, rewrites using the WordPress add_rewrite_rule do not seem to work. For example, the following does not redirect:

    function my_add_rewrite_rules() {
        add_rewrite_rule( 'login/?$', 'wp-login.php', 'top' );
    add_action( 'init' , 'my_add_rewrite_rules' );


  2. MarcusPope
    Plugin Author

    Posted 3 years ago #

    Huh, very interesting. This might be the source of another outstanding issue that I have yet to pin down. Thanks for the very simple steps to reproduce, I'll look into this issue and report my findings here.

    Out of curiosity, is this functionality you need that you wrote or is it just part of a plugin that you use? I ask because if I can't find a solution to the core add_rewrite_rule() function my next best strategy would be to provide an alternate method that you or others can call. This obviously doesn't help you out if it's third party code, but even then I could work with the third party if it's a big enough problem and if they're willing.


  3. MarcusPope
    Plugin Author

    Posted 3 years ago #

    The solution to this problem is to flush the rewrite rules twice - http://lists.automattic.com/pipermail/wp-trac/2012-February/137066.html

    It's due to a core wordpress bug :(

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Root Relative URLs
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic