Created
June 11, 2013 10:15
-
-
Save hiranthi/5755831 to your computer and use it in GitHub Desktop.
See my post on http://onexa.nl/wordpress/aangepaste-url-voor-wp-admin/ for the use of this code (Dutch website)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteBase / | |
# WP automatically redirects domain.com/admin to the correct wp-admin URL, we want to stop this so we're sending the visitor to the homepage | |
RewriteRule ^admin/?(.*?) http://www.domain.com [R=301,L] | |
# Cloaking the wp-admin folder and changing it to domain.com/my-administration/ | |
RewriteRule ^my-administration/(.*?) wp-admin/$1?%{QUERY_STRING} [L] | |
# Default WP stuff goes here --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Filter wp-admin | |
Description: Filter the site_url and get_site_url functions to cloak the wp-admin folder (+ remove the generator tag) | |
Version: 1.0 | |
Author: Onexa - WordPress, webshops & meer | |
Author URI: http://www.onexa.nl | |
*/ | |
/** | |
* Function to filter the site_url and get_site_url functions to make sure the wp-admin links all reflect the changes we've made above. | |
* | |
* @var $url (string) - the URL that's getting filtered | |
* @var $path (string) | |
* @orig_scheme (string) - the type of link / what it's for (ie. login) | |
**/ | |
function onx_wpadmin_filter( $url, $path, $orig_scheme ) | |
{ | |
$old = array( '/(wp-admin)/' ); | |
$new = array( 'my-administration' ); // the new "folder"-name for wp-admin, must be the same as given in the .htaccess & wp-config.php files | |
return preg_replace( $old, $new, $url, 1); | |
} // end onx_wpadmin_filter | |
add_filter('site_url', 'onx_wpadmin_filter', 10, 3); | |
# remove the generator meta-tag to make sure you're not advertising you're using WP to ill-willing people / bots. | |
remove_action('wp_head', 'wp_generator'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Put this just above the "Happy Blogging" line in your wp-config.php | |
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'my-administration' ); // <-- the "my-administration" part should be the same as in the .htaccess | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment