If you install wordpress in a subfolder like /home/example/public_html/wordpress instead of the main DocumentRoot ( usually /home/example.com/public_html ) you will not be able to enable multisite functionality but with a few small changes to wordpress code you can make it work.
My goal was to have the main site ( example.com ) with multisite, host blogs on subdomains like dom1.example.com and then use domain mapping so I could map a domain like dom1.com to dom1.example.com.
Here are the steps I took:
- Extract wordpress-3.1.3.zip in /home/example.com/public_html/wordpress, go to went to http://example.com/wordpress and install, then login as admin to http://example.com/wordpress/wp-admin
- In wp-admin -> Settings both WordPress address (URL) and Site address (URL) were set to http://example.com/wordpress, change Site address (URL) to http://example.com
- copy index.php and .htaccess from /home/example.com/public_html/wordpress to /home/example.com/public_html/
- open /home/example.com/public_html/index.php in an editor and changed the line:
require('./wp-blog-header.php');
torequire('./wordpress/wp-blog-header.php');
At this point you have a working wordpress installed in a subfolder accessible at http://example.com - Open wp-config.php and insert the following lines at the top ( can be right after the first line )
define('WP_ALLOW_MULTISITE', true);
- Open the file wordpress/wp-admin/network.php in a text editor, look for the line: "function network_step1" and a few lines bellow there should be a line:
- span style="color: #ff0000;">'siteurl''home' ) ) {
, replace it with
- span style="color: #ff0000;">'siteurl''home' ) ) {
- Now go to http://example.com/wordpress/wp-admin/network.php and create your network.
- After you create the network, WordPress will ask you to add a few lines to wp-config.php but you'll have to modify them a bit. Here's what I added:
- span style="color: #ff0000;">'MULTISITE''SUBDOMAIN_INSTALL'// default was false
- '/'; // default was /wordpress/
- 'DOMAIN_CURRENT_SITE', 'example.com''PATH_CURRENT_SITE', '/wordpress''SITE_ID_CURRENT_SITE''BLOG_ID_CURRENT_SITE', 1 );
By default SUBDOMAIN_INSTALL was set to false but you want subdomains, and $base was set to "/wordpress" but this needs to be "/"
Don't forget to also add the required lines to .htaccess ( the one in the wordpress/ directory )
- After the network was created, wordpress messed up a bit with the permalink settings for the main domain. Before, the permalink structure was set to: /%year%/%monthnum%/%day%/%postname%/ and wordpress changed it to /blog/%year%/%monthnum%/%day%/%postname%/.
But after I added the above lines to wp-config.php I was able to change the permalink structure back to what it was from Settings->Permalinks - Adding domains
Go to Network admin ( http://example.com/wordpress/wp-admin/network/ ) -> Sites -> Add new . I added
an example domain dom1.example.com. This is what I'll use as an example from now on.After I added the domain I went to Sites , clicked the Edit link bellow the domain and changed Path from / to /wordpress ( with the option "Update siteurl and home as well" checked ) then go to the Settings tab and change the Home to http://dom1.example.com/
At this point you have a working wordpress installed in a subfolder with multisite configured with subdomains. - Install the domain mapping plugin with my changes
- Download the zip file from : http://patchlog.com/wordpress/wpmu-domain-mapping-in-subfolder-install/
- Extract in wp-content/plugins
edit wp-config.php and add the line:
- span style="color: #ff0000;">'SUNRISE', 'on' );
right after the first line
- got to Network Admin -> Tools -> Domain Mapping to configure the plugin and add the mappings
- Come back and let me know how it worked in the comments
Hello,
I get an error after 6. when accesing http://example.com/wordpress/wp-admin/network.php: Parse error: syntax error, unexpected ‘;’ in /public_html/wordpress/wp-admin/network.php on line 136
People with no php experience shouldn’t attempt this 🙂
To answer your problem
at 6 the code on my page was :
if ( 0 & & get_option( ‘siteurl’ ) != get_option( ‘home’ ) ) {
but instead of & it had the html entity for it, ( & amp; )
the wordpress plugin that I’m using to display code has some bugs 🙂
Yeah, just figure out, thank you. But actually I saw another problem after 4. on example.com I have a blog, but without loading the image and css, just plain text.
Hi,
I have added domain mapping for a folder ” http://sitedesign.mlive.com/trail/ ” to http://findnameservers.com
But when we access http://findnameservers.com is showing error as bellow
“””
The page isn’t redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete
—
DNS also pointed.
Kindly suggest.
It looks like you get the same error even without the domain mapping so you have to fix that first.
Hi,
Yes, I have resolved the issue but still mapping is not working.
Main:
http://sitedesign.mlive.com/trail/
Mapped TO
http://findnameservers.com/
Kindly suggest.
Hi there
As soon as i activate your modified plugin i get a redirection loop on every page on the site in chrome… any ideas?