You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-8Lines changed: 17 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
For each site, WordPress core files are separated from wp-content into their own subfolder. That subfolder is actually a symbolic link to a single copy of the WordPress core files.
6
6
7
-
The wp-config.php file is configured to use different database settings for each site, by looking for a unique db-config.php file within the folder for each different site.
7
+
A pointer wp-config file sits next to this single copy of core files and dynamically points to the correct wp-config file within the directory for each site.
8
8
9
9
## Requirements ##
10
10
@@ -24,12 +24,16 @@ First, clone the repository into a folder on your local development server. Be s
24
24
The project has the following structure
25
25
26
26
Project root ..
27
-
- wp-config.php file (used for all sites)
27
+
- wp-config.php file (used for local development only; points to each site folder dynamically, depending on which site is being loaded)
28
28
- wordpress (git submodule of the official WordPress git repository )
29
29
- sample.local (sample site folder)
30
+
- index.php (which looks in the /wordpress folder to run wordpress)
30
31
- wp-content folder (for themes and plugins)
31
-
- db-config.php (database name, user, password, and prefix unique to each site)
32
-
- index.php (which looks in the /wordpress folder)
32
+
- wp-config.php (site configuration, except for database credientials, which go in files below)
33
+
- local-config.php (database credentials for local environment)
34
+
- dev-config.php (database credentials for local environment)
35
+
- staging-config.php (database credentials for local environment)
36
+
- production-config.php (database credentials for local environment)
33
37
34
38
**Important:** create a symlink to the WordPress core files for each site (this is where the magic happens)
35
39
@@ -38,7 +42,11 @@ The project has the following structure
38
42
39
43
## Database Configuration ##
40
44
41
-
Each site should have its own database. The specifics are listed in the db-config.php file within each unique site folder.
45
+
Each site should have its own separate database. The specifics are listed in the various *-config.php files. Put these files in the .gitignore file for your project so that credentials are not stored in version control.
46
+
47
+
Remove the files not needed on each development environment. For example, your production server should only have production-config.php (local-config.php, staging-config.php, and dev-config.php should be deleted from the production server).
48
+
49
+
For *-config.php files on your dev, staging, and production servers, you can place these one directory above the root directory of your site. (This won't work for the local-config.php file, however.)
42
50
43
51
## Apache Configuration ##
44
52
@@ -69,7 +77,7 @@ Modify your system host file to redirect to localhost when that server name is e
69
77
70
78
* Make a copy of your first site
71
79
* Set up a new database for the site
72
-
* Modify the db-config.php file to connect your new database
80
+
* Modify the *-config.php files to connect the sites database in each server environment
73
81
* Set up another virtual host
74
82
75
83
## Tips ##
@@ -88,10 +96,11 @@ Modify your system host file to redirect to localhost when that server name is e
*local-config.php with correct database information
92
100
* wp-content folder
101
+
* wp-config.php (in addition to the first wp-config.php in the parent directory)
93
102
* symbolic link to wordpress directory
94
103
95
104
**Make sure that the ServerName of your virtual host and the directory for your site have the same name.**
96
105
97
-
Thanks to [David Winter](http://davidwinter.me/articles/2012/04/09/install-and-manage-wordpress-with-git/) and [Duane Storey](http://www.duanestorey.com/uncategorized/one-wordpress-install-multiple-sites/) for leading the way
106
+
Thanks to [David Winter](http://davidwinter.me/articles/2012/04/09/install-and-manage-wordpress-with-git/), [Duane Storey](http://www.duanestorey.com/uncategorized/one-wordpress-install-multiple-sites/), and [ashfame](https://gist.github.com/ashfame/1923821) for leading the way
0 commit comments