I have N number of sites in WordPress multi-site. I want to restrict individual site login i.e.,
http://www.example.com/site1/wp-admin
http://www.example.com/site2/wp-admin
Only Network admin can access website/add content. i.e. only Network admin URL should be accessible: http://www.example.com/wp-admin
. If possible all other login URLs should redirect to respective home pages. Is there any functions or .htaccess
rule to achieve this?
.htaccess
file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
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