Hi there! This would be SUCH A GREAT solution. I came here forwarded by a question I made on Stackoverflow.
I followed this step by step but still being able to log through /wp-admin and my “secret-folder” shows a 404.
Any ideas?
Thanks!
It works fine for me… Check below code for each file..
.htacess code:
[Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]
Hi there, thanks again for answer me.
I just followed your structure, I realized that it is working but in a different way I imagined.
On the initial question I wanted to change the login URL. In this case, if your type your site URL/wp-admin you will still getting the login form, my idea was to move everything to a different path, show a 404 if anyone puts /wp-admin on your site.
What I found here is that my dashboard is now showing the site.com/secret-folder URL once logged in, but the login form is still shown under /wp-admin and if you type site.com/secret-folder I get a 404.
Best.
Put slash at the end of url..
e.g. : site.com/secret-folder/
Is there a way to make /wp-admin inaccessible and have /secret-folder/ as the only way to access the login page?
Yes above code allow you to implement the admin login for url..
site.com/secret-folder/
and below code will restrict the URL : site.com/wp-admin
add_action(‘login_form’,’redirect_wp_admin’);
function redirect_wp_admin(){
$redirect_to = $_SERVER[‘REQUEST_URI’];
if(count($_REQUEST)> 0 && array_key_exists(‘redirect_to’, $_REQUEST)){
$redirect_to = $_REQUEST[‘redirect_to’];
$check_wp_admin = stristr($redirect_to, ‘wp-admin’);
if($check_wp_admin){
wp_safe_redirect( ‘404.php’ );
}
}
}
On which file do i put above code??
This doesnt seem to be working for me. I tried using example.com/admin and it redirects me to example.com/wp-admin
Which parts of the code do I edit?
define('WP_ADMIN_DIR', 'admin');
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);
add_filter('http://www.example.com', '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);
}
RewriteRule ^admin/(.*) wp-admin/$1?%{QUERY_STRING} [L]
This is how I edited the code
I have the same issue a greyblok, whenever I try going to I tried using example.com/admin I get redirected to example.com/wp-admin…
Also, when adding the code OP posted (to functions.php), I get the following error message:
Fatal error: Call to undefined function add_filter() in /home1/*****/public_html/site.com/wp-includes/functions.php on line 11
Thoughts?
Hello everyone, I currently have a wordpress.com blog now I want to change it over to wordpress.org to be included with my website. I have downloaded .org however I can not figure out how to login wpadmin where do I find this.
@Bagladyb: As per the Forum Welcome, please post your own topic. Posting in an existing topic prevents us from being able to track issues by topic. Added to which, your problem – despite any similarity in symptoms – is likely to be completely different.