Last active
June 11, 2016 06:22
-
-
Save bryanwillis/ad7deed1b6613e2f5e1f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
RewriteRule ^dashboard/(.*) wp-admin/$1?%{QUERY_STRING} [L] | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> | |
# END WordPress |
This file contains hidden or 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
#CUSTOM ADMIN URL REWRITE | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^dashboard[^/]*$ dashboard/ [R=301,L] | |
RewriteCond %{QUERY_STRING} (.*)$ | |
RewriteRule ^dashboard(.*)$ wp-admin$1? [QSA,L,NE] | |
RewriteCond %{QUERY_STRING} (.*)$ | |
RewriteRule ^wp-admin/?$ / [NE,R=404,L] | |
RewriteCond %{QUERY_STRING} (.*)$ | |
RewriteRule ^wp-admin/(.*)$ dashboard/$1 [QSA,R=301,L,NE] | |
</IfModule> | |
#CUSTOM ADMIN URL REWRITE | |
RewriteRule ^admin/(.*) wp-admin/$1?%{QUERY_STRING} [L] | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> |
This file contains hidden or 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
# fix for rewrite class static files | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
# uploaded files | |
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] | |
# add a trailing slash to /wp-admin | |
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] | |
# Fix using the previous answer. | |
RewriteRule ^admin/(.*)$ wp-admin/$1 [QSA,L] | |
RewriteCond %{REQUEST_FILENAME} -f [OR] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^ - [L] | |
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L] | |
#Fix to load css js image files for multi site admin urls. | |
#old code RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L] | |
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.(php|css|js|png|jpg|gif))$ $1 [L] | |
RewriteRule . index.php [L] |
This file contains hidden or 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
#CUSTOM ADMIN URL REWRITE | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^dashboard[^/]*$ dashboard/ [R=301,L] | |
RewriteCond %{QUERY_STRING} (.*)$ | |
RewriteRule ^dashboard(.*)$ wp-admin$1? [QSA,L,NE] | |
RewriteCond %{QUERY_STRING} (.*)$ | |
RewriteRule ^wp-admin/?$ / [NE,R=404,L] | |
RewriteCond %{QUERY_STRING} (.*)$ | |
RewriteRule ^wp-admin/(.*)$ dashboard/$1 [QSA,R=301,L,NE] | |
</IfModule> | |
#CUSTOM ADMIN URL REWRITE |
This file contains hidden or 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
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /subcataloged/cliens-wp/ | |
RewriteRule ^index\.php$ - [L] | |
# add a trailing slash to /wp-admin | |
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] | |
RewriteCond %{REQUEST_FILENAME} -f [OR] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^ - [L] | |
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] | |
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] | |
RewriteRule . index.php [L] | |
</IfModule> | |
# END WordPress |
This file contains hidden or 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
# END WordPress | |
#HERE | |
RewriteRule ^wp-admin/?$ /dashboard [R,L] | |
RewriteRule ^wp-admin/(.*)/?$ /dashboard/$1 [R,L] | |
RewriteRule ^dashboard/?$ /wp-admin | |
RewriteRule ^dashboard/(.*)$ /wp-admin/$1 |
This file contains hidden or 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
RewriteBase / | |
RewriteCond %{THE_REQUEST} ^GET\ /wp-admin/ | |
RewriteRule ^wp-admin/(.*)$ dashboard/$1 [R,L] | |
RewriteRule ^dashboard(.*)$ wp-admin$1 | |
RewriteRule ^admin/(.*)$ wp-admin/$1 [QSA,L] |
This file contains hidden or 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 | |
define('WP_ADMIN_DIR', 'admin'); | |
defined('SITECOOKIEPATH') || define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); | |
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR); | |
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); | |
} | |
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' ); | |
} | |
} | |
} |
This file contains hidden or 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
return ChangeAdminUrlPlugin::bootstrap(); | |
class ChangeAdminUrlPlugin { | |
private $renameFrom = 'wp-admin'; | |
private $renameTo = 'admin'; | |
static $instance; | |
static public function bootstrap() { | |
null === self::$instance | |
&& self::$instance = new self() | |
; | |
return self::$instance; | |
} | |
private function setCookiePath() { | |
defined('SITECOOKIEPATH') || define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); | |
defined('ADMIN_COOKIE_PATH') || define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . $this->renameTo); | |
} | |
public function __construct() { | |
$this->setCookiePath(); | |
add_action('init', array($this, 'init')) ; | |
} | |
public function init() { | |
add_filter('admin_url', array($this, 'admin_url'), 10, 3); | |
} | |
public function admin_url($url, $path, $blog_id) { | |
$renameFrom = $this->renameFrom; | |
$renameTo = $this->renameTo; | |
$scheme = 'admin'; | |
$find = get_site_url($blog_id, $renameFrom.'/', $scheme); | |
$replace = get_site_url($blog_id, $renameTo.'/', $scheme); | |
(0 === strpos($url, $find)) | |
&& $url = $replace.substr($url, strlen($find)) | |
; | |
return $url; | |
} | |
} | |
#EOF; | |
public function admin_url($url, $path, $blog_id) { | |
$scheme = (0 === strpos($url, '/')) ? 'relative' : 'admin'; | |
$find = get_site_url($blog_id, $this->renameFrom . '/', $scheme); | |
$replace = get_site_url($blog_id, $this->renameTo . '/', $scheme); | |
(0 === strpos($url, $find)) | |
&& $url = $replace . substr($url, strlen($find)); | |
return $url; | |
} |
This file contains hidden or 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
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L] | |
.(xml|css|jpe?g|png|gif|js)$ | |
^.+\.(?:js|css|jpe?g|htc|xml|otf|ttf|eot|woff|gif|png|svg|ico|pdf|html|htm)$ | |
(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|ico) | |
/(.*\.(php|css|js|png|jpg|gif))$ | |
^dasahboard/(images|js|css)/(.*)$ wp-admin$1 | |
RewriteRule ^admin/(.*)$ wp-admin/$1 [QSA,L] | |
RewriteRule ^admin/(.*)$ wp-admin/$1 [QSA,L] | |
RewriteRule ^admin/(.*)$ /wp-admin/$1 [QSA,L] | |
defined('SITECOOKIEPATH') || define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); | |
defined('ADMIN_COOKIE_PATH') || define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . $this->renameTo); | |
} add_filter('admin_url', array($this, 'admin_url'), 10, 3); | |
\.(gif|png|jpg|js|css|swf)$ | |
RewriteRule ^(scripts|css)/(.+)\.(.+)\.(js|css)$ $1/$2.$4 [L] | |
RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif|png|css|js|txt|ico|pdf)$ [NC] | |
^wp-admin/css/\.(jpg|gif|png|css|js|txt|ico|pdf)$ |
This file contains hidden or 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
// Add rewrite rule and flush on plugin activation | |
register_activation_hook( __FILE__, 'wp_ozh_plu_activate' ); | |
function wp_ozh_plu_activate() { | |
wp_ozh_plu_rewrite(); | |
flush_rewrite_rules(); | |
} | |
// Flush on plugin deactivation | |
register_deactivation_hook( __FILE__, 'wp_ozh_plu_deactivate' ); | |
function wp_ozh_plu_deactivate() { | |
flush_rewrite_rules(); | |
} | |
// Create new rewrite rule | |
add_action( 'init', 'wp_ozh_plu_rewrite' ); | |
function wp_ozh_plu_rewrite() { | |
add_rewrite_rule( 'login/?$', 'wp-login.php', 'top' ); | |
} |
This file contains hidden or 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
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' ); | |
} | |
} | |
} |
This file contains hidden or 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 | |
/** | |
* Change Admin URL | |
* | |
* Copyright (C) 2010 hakre <http://hakre.wordpress.com/> | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU Affero General Public License as | |
* published by the Free Software Foundation, either version 3 of the | |
* License, or (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU Affero General Public License for more details. | |
* | |
* You should have received a copy of the GNU Affero General Public License | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
* | |
* USAGE: | |
* | |
* Copy the file into wp-content/mu-plugins directory and add the | |
* following RewriteRule to your apache configuration or .htaccess: | |
* | |
* RewriteRule ^admin/(.*)$ wp-admin/$1 [QSA,L] | |
* | |
* It will rewrite the wordpress admin-URL | |
* | |
* from: http://example.com/wp-admin/ ... | |
* to : http://example.com/admin/ ... | |
* | |
* @author hakre <http://hakre.wordpress.com> | |
* @see http://wordpress.stackexchange.com/questions/4037/how-to-redirect-rewrite-all-wp-login-requests/4063 | |
* @todo mod_rewrite_rules - filter to insert into .htacces on plugin activation | |
* | |
*/ | |
/** Updated version my Mark Figueredo, <http://gruvii.com/> **/ | |
return ChangeAdminUrlPlugin::bootstrap(); | |
class ChangeAdminUrlPlugin { | |
private $renameFrom = 'wp-admin'; | |
private $renameTo = 'admin'; | |
static $instance; | |
static public function bootstrap() { | |
null === self::$instance | |
&& self::$instance = new self() | |
; | |
return self::$instance; | |
} | |
private function setCookiePath() { | |
defined('SITECOOKIEPATH') || define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); | |
defined('ADMIN_COOKIE_PATH') || define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . $this->renameTo); | |
} | |
public function __construct() { | |
$this->setCookiePath(); | |
add_action('init', array($this, 'init')) ; | |
} | |
public function init() { | |
add_filter('admin_url', array($this, 'admin_url'), 10, 3); | |
add_filter('network_admin_url', array($this, 'network_admin_url'), 10, 3);//Added by Mark Figueredo, <http://gruvii.com/> | |
} | |
public function admin_url($url, $path, $blog_id) { | |
$renameFrom = $this->renameFrom; | |
$renameTo = $this->renameTo; | |
$scheme = 'admin'; | |
$find = get_site_url($blog_id, $renameFrom.'/', $scheme); | |
$replace = get_site_url($blog_id, $renameTo.'/', $scheme); | |
(0 === strpos($url, $find)) | |
&& $url = $replace.substr($url, strlen($find)) | |
; | |
return $url; | |
} | |
// Added by Mark Figueredo, <http://gruvii.com/> | |
public function network_admin_url($url, $path) { | |
$renameFrom = $this->renameFrom; | |
$renameTo = $this->renameTo; | |
$scheme = 'admin'; | |
$find = network_site_url($renameFrom.'/', $scheme); | |
$replace = network_site_url($renameTo.'/', $scheme); | |
(0 === strpos($url, $find)) | |
&& $url = $replace.substr($url, strlen($find)) | |
; | |
return $url; | |
} | |
} |
This file contains hidden or 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
# RewriteRule ^dashboard/(.*) wp-admin/$1?%{QUERY_STRING} [L] | |
# BEGIN WordPress | |
# <IfModule mod_rewrite.c> | |
# RewriteEngine On | |
# RewriteBase / | |
# RewriteRule ^index\.php$ - [L] | |
# RewriteCond %{REQUEST_FILENAME} !-f | |
# RewriteCond %{REQUEST_FILENAME} !-d | |
# RewriteRule . /index.php [L] | |
# </IfModule> | |
# END WordPress | |
<?php | |
// This goes in mu-plugins folder | |
function my_custom_admin_url($path) { | |
return str_replace('wp-admin', 'dashboard', $path); | |
} | |
add_filter('admin_url', 'my_custom_admin_url'); |
This file contains hidden or 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 / | |
##### ABOVE THIS POINT IS ALREADY INSERTED BY WORD PRESS | |
##### Michi’s code is BELOW ##### | |
RewriteCond %{REQUEST_URI} wp-admin/ | |
RewriteCond %{QUERY_STRING} !YOURSECRETWORDHERE | |
RewriteRule .*\.php [F,L] | |
RewriteCond %{QUERY_STRING} !YOURSECRETWORDHERE | |
RewriteRule ^ADMINFOLDER/(.*) wp-admin/$1?%{QUERY_STRING}&YOURSECRETWORDHERE [L] | |
##### Michi’s code is ABOVE ##### | |
##### BELOW THIS POINT IS ALREADY INSERTED BY WORD PRESS | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
##################### |
This file contains hidden or 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
class ChangeAdminUrlPlugin { | |
private $renameFrom = 'wp-admin'; | |
private $renameTo = 'admin'; | |
static $instance; | |
static public function bootstrap() { | |
null === self::$instance | |
&& self::$instance = new self() | |
; | |
return self::$instance; | |
} | |
private function setCookiePath() { | |
defined('SITECOOKIEPATH') || define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); | |
defined('ADMIN_COOKIE_PATH') || define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . $this->renameTo); | |
} | |
public function __construct() { | |
$this->setCookiePath(); | |
add_action('init', array($this, 'init')) ; | |
} | |
public function init() { | |
add_filter('admin_url', array($this, 'admin_url'), 10, 3); | |
add_filter('network_admin_url', array($this, 'network_admin_url'), 10, 3);//Added by Mark Figueredo, <http://gruvii.com/> | |
} | |
public function admin_url($url, $path, $blog_id) { | |
$renameFrom = $this->renameFrom; | |
$renameTo = $this->renameTo; | |
$scheme = 'admin'; | |
$find = get_site_url($blog_id, $renameFrom.'/', $scheme); | |
$replace = get_site_url($blog_id, $renameTo.'/', $scheme); | |
(0 === strpos($url, $find)) | |
&& $url = $replace.substr($url, strlen($find)) | |
; | |
return $url; | |
} | |
// Added by Mark Figueredo, <http://gruvii.com/> | |
public function network_admin_url($url, $path) { | |
$renameFrom = $this->renameFrom; | |
$renameTo = $this->renameTo; | |
$scheme = 'admin'; | |
$find = network_site_url($renameFrom.'/', $scheme); | |
$replace = network_site_url($renameTo.'/', $scheme); | |
(0 === strpos($url, $find)) | |
&& $url = $replace.substr($url, strlen($find)) | |
; | |
return $url; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment