Change Wordpress Admin URL

后端 未结 6 1947
遇见更好的自我
遇见更好的自我 2020-11-28 11:37

I changed my Wordpress directory structure quite a bit. Here\'s what I have:

define(\'WP_SITEURL\', \'http://\' . $_SERVER[\'SERVER_NAME\'] . \'/wordpress\'         


        
6条回答
  •  悲&欢浪女
    2020-11-28 12:05

    I played around with this and there is a much simpler way to do this all in this one simple function below without having to muck around with anything else (create unnecessary folders, redirects, pages, etc.).

    // Simple Query String Login page protection
    function example_simple_query_string_protection_for_login_page() {
    
    $QS = '?mySecretString=foobar';
    $theRequest = 'http://' . $_SERVER['SERVER_NAME'] . '/' . 'wp-login.php' . '?'. $_SERVER['QUERY_STRING'];
    
    // these are for testing
    // echo $theRequest . '
    '; // echo site_url('/wp-login.php').$QS.'
    '; if ( site_url('/wp-login.php').$QS == $theRequest ) { echo 'Query string matches'; } else { header( 'Location: http://' . $_SERVER['SERVER_NAME'] . '/' ); } } add_action('login_head', 'example_simple_query_string_protection_for_login_page');

提交回复
热议问题