WordPress uses symbolic links to share core directories
Background:
I deployed several (about 10) WordPress sites in an ubuntu-server.
For each one, I have a mysql database (single schema) and a WordPress file directory.
For each WordPress directory instance, the structure is as follows:
|-- wp-admin
| |-- css
| |-- images
| |-- includes
| |-- js
| |-- maint
| |-- meta
| |-- network
| `-- user
|-- wp-content
| |-- cache
| |-- languages
| |-- plugins
| |-- themes
| |-- upgrade
| `-- uploads
`-- wp-includes
|-- certificates
|-- css
|-- fonts
|-- ID3
|-- images
|-- js
|-- pomo
|-- SimplePie
|-- Text
`-- theme-compat
So I found the wp-admin and wp-content
directories redundant because they are a core part of WordPress and I would never change them manually.
To reduce space in these parts, I kept one instance, and for the others, I created symbolic links on them.
For example, I have a basic example:
/var/www/wordpress/
And one of my websites:
/var/www/site1/
I use these commands to change the structure :
$ cd /var/www/site1
$ rm -rf wp-admin
$ rm -rf wp-includes
$ ln -s /var/www/wordpress/wp-admin ./
$ ln -s /var/www/wordpress/wp-includes ./
Well, I run site1
, effect.
Question:
After this, I can’t get into the admin panel.
When I navigate to: http://mysite.mydomain.com
.
It redirects to the login page, and no matter what I enter (I can make sure the username and password are correct), it can’t log in.
Session seems to have been created incorrectly, can anyone point out what’s going on?
Please help, thanks.
Solution
Try mounting the folder instead of using a symbolic link. Something like that
mount --bind /var/www/wordpres/wp-admin /var/www/site1/wp-admin
Ensure that the directory is created before mounting. If this works for you, then make sure you have a mount in your /etc/fstab