How to redirect/rewrite all /wp-login requests

Is there any simple way to have wordpress, php or apache rewrite all urls which involve /wp-admin to /admin?

I have added this entry to my .htaccess file:

RewriteRule ^admin /wp-login.php [L]

However although will correctly show the login page all pages after you login show the URL as /wp-admin which I want to always show /admin.

Any thoughts on this?

Solutions Collecting From Web of "How to redirect/rewrite all /wp-login requests"

To answer you question as a apache URL layout configuration via mod_rewrite (the apache module that handles URL rewriting), this could be helpful:

RewriteRule ^admin/(.*)$ /wp-admin/$1 [QSA,L]

(untested configuration directive, check the docs in case this does errors)

This will basically translate any request to /admin/… into /wp-admin/… .

If that’s the only thing you would like to know, I must admit that this is slightly off-topic for worpdress@se as this is acutally a question how to configure the apache webserver. A better place might be serverfault.

Keep in mind that this only rewrites the URLs that get requested. WordPress would know nothing about this and it does still output links to /wp-admin/ on the admin then. There is a hook for any admin URL that you might want to rewrite then as well:

return apply_filters('admin_url', $url, $path, $blog_id);

You would need to replace the domain/wp-admin/ part with domain/admin/ with a filter on your own.

hakre…. Great answer… now with the latest version of wordpress having a separate network admin I used your solution and added in the part to properly rewrite the “Network Admin” links in the same way…

     * Change Admin URL
     * Copyright (C) 2010  hakre <>
     * 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
     * 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 <>.
     * 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: ...
     *   to  : ...
     * @author hakre <>
     * @see
     * @todo mod_rewrite_rules - filter to insert into .htacces on plugin activation
    /** Updated version my Mark Figueredo, <> **/
    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() {
      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, <>
     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, <> 
     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;

In addition to the previous solutions. I found the missing css and script files.

the fix is

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]