WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Redirect hits instead of creating a 404?

[Resolved] Redirect hits instead of creating a 404?

  • MeisterHundekuchen
    Member

    @meisterhundekuchen

    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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author iseulde
    Participant

    @iseulde

    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.

    MeisterHundekuchen
    Member

    @meisterhundekuchen

    hey, yes that would be great 🙂

    Plugin Author iseulde
    Participant

    @iseulde

    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;
    
    	}
    
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Redirect hits instead of creating a 404?’ is closed to new replies.