0

I read all your post regarding renaming and moving the admin folder a few times but I still didn't find the real answers to my question!

I got a page, lets say available under mysite.com ,the real wordpress is found under mysite.com/wordpress (of course not directly available over that link) and therefore my wp admin under mysite.com/wordpress/wp-admin/

I made the needed adaptions in the index.php and used the following commands in my .htaccess to make my wordpress available under mysite.com

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

Everything is working perfect now BUT want to realise the follwing. I want to reach my admin section JUST over lets say mysite.com/secret-area and mysite.com/secretarea/ and NOT ANYMORE over mysite.com/blog/wp-admin/ or mysite.com/blog/admin

If I would be able to realise a server based password protection for that path too, it would be extremly great :)

How can I realise that over .htaccess ?

I did a lot of research and tried a lot of things but couldn't get it done in the end :/

Thx a lot for your help guys! Nice Regards, Stephan

1
  • Read all of whose posts? Can you link to any reference material you've found, this is a Q&A site not a blog/forum. Also can you provide more information about your install, is it a multisite? You're aware with pretty permalinks turned on that visiting /admin will redirect users to the admin panel wherever it may be?
    – Tom J Nowell
    Commented Jun 22, 2014 at 22:59

1 Answer 1

0

There's a thread about this on the Wordpress forums:

http://wordpress.org/support/topic/how-to-change-the-admin-url-or-wp-admin-to-secure-login?replies=13

The original article has three steps:

(1) Add constant to wp-config.php

define('WP_ADMIN_DIR', 'secret-folder');
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);

(2) Add this 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 this line to .htaccess on your server

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

With these steps taken, your admin URL will be: http://www.yourdomain.com/secret-folder/

2
  • Can you extract the relevant information and post it as an answer? A link offsite is not an answer, and becomes useless if the URL changes or breaks
    – Tom J Nowell
    Commented Jun 23, 2014 at 0:11
  • 1
    @TomJNowell - Steps added above. Commented Jun 23, 2014 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.