• Resolved generosus

    (@generosus)


    Good Day,

    It appears your plugin’s redirect tool does not work when the source URL contains /wp-admin/* or /wp-login.php*

    Your plugin’s redirect tool, however, does works for standard pages or posts.

    Details: https://prnt.sc/HH4WV23taher

    We tried every imaginable troubleshooting procedure, but still not working.

    This is what we tried:

    1. Deactivated all plugins, except theme core and yours.
    2. Whitelisted Rank Math in Wordfence per your procedure.
    3. Recreated our Rank Math database tables using your tool.
    4. Purged all cache.
    5. Resaved our permalinks in WP Dashboard > Settings.

    What did we miss? Help appreciated.

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter generosus

    (@generosus)

    Update:

    Found this forum topic (similar to our case), but it was posted almost two years ago.

    If the response in the provided topic still applies, can you guys then kindly provide a code snippet (filter) that will allow us to redirect our wp-admin or wp-login URLs as noted above?

    Thank you!

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @generosus,

    Thank you for contacting Rank Math and sorry for any inconvenience this issue may have caused.

    Unfortunately, Rank Math redirections still do not work if the URL contains “wp-content”, “wp-admin” or “wp-login.php” as we currently don’t support it.

    You may need to redirect it using server configuration or any other plugin that supports it. We would recommend using the .htaccess file.

    Hope that helps.

    Thread Starter generosus

    (@generosus)

    @rankmathteam,

    Thank you for the quick reply.

    Why does Rank Math not support wp-admin redirects? Also, other than recommending using the .htaccess file, can you provide a filter or code snippet that will allow us to accomplish this? Should we request the code snippet via private ticket?

    By looking at your forums (Rank Math and WordPress), it appears many others can use the code and/or enhancement.

    Again, thank you.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @generosus,

    Unfortunately, we don’t have any filters to achieve this. It can only be done using server configuration or .htaccess. You can also use a separate redirection plugin that can handle these types of redirections.

    Having said that, we have added your request to our internal list of suggestions. If your suggestion is something we decide to implement in our plugin, we will be sure to let you know.

    Don’t hesitate to get in touch in case you need our assistance with anything else.

    Thread Starter generosus

    (@generosus)

    Solution:

    There’s no need to modify the .htaccess file nor use another re-direct plugin as stated by Rank Math.

    For those who need to redirect WP-Admin URLs, please use the following code snippet (add it to your functions.php file or use the plugin Code Snippets):

    add_action( 'admin_init', 'redirect_non_logged_users_to_specific_page' );
    
    function redirect_non_logged_users_to_specific_page() {
    
    if ( !is_user_logged_in() && is_page('add page slug or ID here') && $_SERVER['PHP_SELF'] != '/wp-admin/admin-ajax.php' ) {
    
    wp_redirect( 'http://www.example.dev/page/' ); 
        exit;
       }
    }

    Note: If using the plugin Code Snippets, make sure to run the snippet everywhere or in the administration area.

    Cheerio!

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @generosus,

    We are glad that you are able to create a workaround. Thank you so much for sharing it.

    Please do not hesitate to let us know if you need our assistance with anything else.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Redirection Tool Not Working for WP-ADMIN’ is closed to new replies.