I want to change wp-admin to admin_panel using .htaccess file and when visit link admin_panel, it displays the contents of wp-admin, but when visit link wp-admin, it will notice not found
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/wp/
RewriteRule ^index\.php$ - [L]
RewriteRule ^admin_panel/(.*) /cms/wp/wp-admin/$1 [QSA,L]
RewriteRule ^wp-admin /cms/wp/nothing_404_404 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cms/wp/index.php [L]
</IfModule>
# END WordPress
It not working, all url wp-admin or admin_panel result not found both.
I have no idea why you are trying to accomplish this only using .htaccess file but let me show you the correct way to change the admin directory.
If there is a specific reason why you want it to be done only using .htaccess file please let me know however I am not even sure if it is possible.
Steps:
Add constant to wp-confing.php
define('WP_ADMIN_DIR', 'admin_panel');
define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);
Add below filter to 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 below line to .htaccess file
RewriteRule ^admin_panel/(.*) wp-admin/$1?%{QUERY_STRING} [L]
And you are done.
Now your admin URL will be like: http://www.yourdomain.com/admin_panel/
Hope this help.