I don't like that WordPress sticks its branding everywhere, like with http://example.com/wp-admin
. I would much prefer a debranded version like http://example.com/admin
. Is this possible with a .htaccess rule? Is this a bad idea from a security and/or accessibility point of view?
-
May be this Thread can help you serverfault.com/questions/281881/…– Sujith Kumar KSApr 25, 2012 at 15:23
2 Answers
Follow the changes bellow:
.htacess code
RewriteRule ^secret-folder/(.*) wp-admin/$1?%{QUERY_STRING} [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress-3.3/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress-3.3/index.php [L]
</IfModule>
# END WordPress
wp-config.php
define('WP_ADMIN_DIR', 'secret-folder');
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);
themes/your_theme_name/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);
}
add_action( 'admin_init', 'restrict_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' );
}
}
}
See How to Hide The Fact That You’re Using WordPress | Ben Word
• Cleaning up the output of wp_head and removing the generator from RSS feeds
• Hiding /wp-content/ by rewriting static theme assets (CSS, JS, and images)
• Cleaning up the output of navigation menus with a custom walker
• Root relative URLs