Moving wp-admin to a different to a subdomain

I’m using BitNami WAMPStack, but theoretically it could be used for a Linux installation

Here is how I did it:

1) Installed BitNami WAMPStack on secondary server.

2) Deleted the secondary servers’ htdocs folder and copied the entire htdocs folder from the primary to the secondary server.

3) open “C:\Program Files\BitNami WAMPStack\apps\wordpress\htdocs\wp-config.php” and edit section for MySQL hostname on the secondary server. Point it to the primary serve hostname/IP.

4) Enable the secondary box to connect to the primary mysql server.
-Open MySQL Workbench
-Open Admin
-Go to Users and Privileges under Security section on the left pane
-Add Account
-Username should be root (or whatever the username is specified in the wp-config.php), and the password, add IP address of the secondary box.
-Then go to adminstrative roles and click DBA, then click apply.

5) Edit the login feature so it doesn’t redirect to the primary box
edit “C:\Program Files\BitNami WAMPStack\apps\wordpress\htdocs\wp-includes\link-template.php”
add on line 1940 the following block of code
// For admin site change
$url = str_replace( ‘://www.’, ‘://admin.www.’, $url );

6) on primary box, Rename “C:\Program Files\BitNami WAMPStack\apps\wordpress\htdocs\wp-admin” to “C:\Program Files\BitNami WAMPStack\apps\wordpress\htdocs\wp-admin_disabled”

7) on primary box, Create a new folder “C:\Program Files\BitNami WAMPStack\apps\wordpress\htdocs\wp-admin”
In that folder create a file called index.php, and paste the code block below into the file and save

8) wampstackMySQL has been stopped on secondary, since there is no need to have in running.

9) Need to change the upload path for content for the media library.

a. On primary, need to share (smb) out “C:\Program Files\BitNami WAMPStack\apps\wordpress\htdocs\wp-content\uploads” folder and give Full Control to Everyone on Sharing and Permissions. (could be more secure, however the wampstackApache service seems to not want use a domain account to run).
b. Had to disable W3 Total Cache plugin as it was not working well with the changes.
c. Make the following changes on the newly configured admin portal, go to the new admin portal on http://admin.www.your-domain-name.com/, go to the Settings -> Media and put the SMB Share \hostname-primary-server\uploads in the “Store uploads in this folder”

When installing new plug-ins, it will be necessary to sync files up periodically to ensure both frontend and backend functionality. Testing should always be done before introducing new changes to ensure that both sides continue to work. It’s not perfect, but it works.