WordPress.org

Forums

Rename wp-login.php (unmaintained)
[resolved] Redirect hits instead of creating a 404? (4 posts)

  1. MeisterHundekuchen
    Member
    Posted 1 year ago #

    Hello Fellow-Users,

    I've just discovered this wonderful plugin to hide my login-page, so first of all: thanks for the nice work :-)

    I wonder if it is possible (or more: _how_ it is possible) to redirect the foreign hits on /wp-admin/ and wp-login.php to another website like http://www.google.de or to a local stophackingthissite.html instead of the regular 404 page.

    I'm out of coding php for some years, so i have no exact clue, but i guess you can customize the function set_404() to do something like this, correct? ;-)

    Best regards!

    http://wordpress.org/plugins/rename-wp-login/

  2. Ella Iseulde Van Dorpe
    Member
    Plugin Author

    Posted 1 year ago #

    Hello,

    If you want I can add a hook there so you can add some code in your theme to customise the behaviour. I don't want to add too many options on the back-end.

  3. MeisterHundekuchen
    Member
    Posted 1 year ago #

    hey, yes that would be great :-)

  4. Ella Iseulde Van Dorpe
    Member
    Plugin Author

    Posted 1 year ago #

    Actually you don't even need a hook in the plugin. If you hook in login_init, you can redirect hits from there, but you need to hook in early enough before the plugin sets a 404. Don't do this with a multisite though.

    add_action( 'login_init', 'your_login_init', 1 );
    
    function your_login_init() {
    
    	if ( strpos( $_SERVER['REQUEST_URI'], 'wp-login' ) !== false ) {
    
    		wp_redirect( 'http://example.com' ); die;
    
    	}
    
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Rename wp-login.php (unmaintained)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.