fish_ball fish_ball - 1 year ago 88
Linux Question

Wordpress share core directories using symbolic links


I'm deploying several (about 10) wordpress sites in a single ubuntu-server.

For each, I have a single mysql database (single schema), and a single wordpress file directories.

For each instance of wordpress directories, the structure is like the below:

|-- 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 that the
directories is redundant, because they're wordpress core part, I will never change them manually.

To reduce the space of these parts, I keep one instance, and for the others, I created symbolic links on them.

For example, I have one base instance first:


And one of mysite:


I change the structure using these commands:

$ 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 the
, it effects.


After this, I'm not able to enter the admin panel.

When I navigate to:

It redirect to the login page, and no matter what I was entering (I can make sure the username and password are correct), it cannot login.

It seems the session cannot create correctly, can anyone point out what's the matter here?

Please help, thank you.

Answer Source

Try mounting the folders instead of using symbolic link. Something similar to this

mount --bind /var/www/wordpres/wp-admin /var/www/site1/wp-admin

make sure you have the directory created before you mount. If this works for you then make sure you have the mount in your /etc/fstab

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download