$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>customization - Change from wp-admin to something else?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

customization - Change from wp-admin to something else?

matteradmin10PV0评论

I have found a couple of plugins which lets me set another URL. For example example/login instead of /wp-admin. But as soon as you go to that adress you are back on /wp-admin. So it is only like a redirect.

How do I change it so that all the url's change too?

I have found a couple of plugins which lets me set another URL. For example example/login instead of /wp-admin. But as soon as you go to that adress you are back on /wp-admin. So it is only like a redirect.

How do I change it so that all the url's change too?

Share Improve this question asked Mar 7, 2018 at 11:34 jockebqjockebq 4631 gold badge6 silver badges18 bronze badges 1
  • Unless you really know what you're doing, you will probably break the site by renaming (plugins may require that structure or need to be changed) – kero Commented Mar 7, 2018 at 13:03
Add a comment  | 

3 Answers 3

Reset to default 4

Generally speaking, you don't. The "wp-admin" is hardcoded in many places.

At WPMU DEV they suggest the following Apache configuration if you need to rename the admin/login pages for security/customization.

# BEGIN Hide login page
RewriteRule ^mylogin$ https://%{SERVER_NAME}/wp-login.php?key=123&redirect_to=https://%{SERVER_NAME}/wp-admin/index.php [L]

RewriteCond %{HTTP_REFERER} !^https://%{SERVER_NAME}/wp-admin
RewriteCond %{HTTP_REFERER} !^https://%{SERVER_NAME}/wp-login.php
RewriteCond %{HTTP_REFERER} !^https://%{SERVER_NAME}/login
RewriteCond %{QUERY_STRING} !^key=123
RewriteCond %{QUERY_STRING} !^action=logout
RewriteCond %{QUERY_STRING} !^action=lostpassword
RewriteCond %{REQUEST_METHOD} !POST
# END Hide login page

Change mylogin to a slug of your choice and 123 to another more secure passphrase.

Credits: https://premium.wpmudev/blog/hide-wordpress-login-page-2/

Steps:

  1. Add constant to wp-config.php

    define('WP_ADMIN_DIR', 'secret-folder');
    define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);
    
  2. Add below filter to functions.php

    add_filter('site_url',  'wpadmin_filter', 10, 3);
        function wpadmin_filter( $url, $path, $orig_scheme ) {
        $old  = array( "/(wp-admin)/");
        $admin_dir = WP_ADMIN_DIR;
        $new  = array($admin_dir);
        return preg_replace( $old, $new, $url, 1);
    }
    
  3. Add below line to .htaccess file

    RewriteRule ^securelogin/(.*) wp-admin/$1?%{QUERY_STRING} [L]
    

Done…!!!

Now your admin URL will be like: http://www.example/securelogin/

Note: put "/" after securelogin

Post a comment

comment list (0)

  1. No comments so far