Transfer multisite subdomain installation to multisite subdirectory format
-
Hello,
As we’ve decided to go fromtopic1.com
en.topic1.com for English speakers
ja.topic1.com for Japanese speakers
xx.topic1.com for xx speakersto
topic1.com
topic1.com/en for English speakers
topic1.com/ja for Japanese speakers
topic1.com/xx for xx speakersAnd we have a 1 year old site which used the subdomain installation.
What is the best way to transfer all databases and redirect multisite subdomain installation links to multisite subdirectory format?Please note this is the first time we transfer a site from one WordPress installation to another.
Using 3.2.1 on original WP installation and 3.3.2 on new WP installation
-
Guess what? Don’t have to transfer 🙂
http://codex.ww.wp.xz.cn/Multisite_Network_Administration#Switching_network_types
Now you will want to go through your tables and look at wp_sites and wp_sitemeta to make sure they’re okay, and probably use http://interconnectit.com/124/search-and-replace-for-wordpress-databases/ to search for en.topic1.com and replac with topic1.com and so on, but you have the ability to switch. Just make a backup first and be careful!
That is excellent news!
We are moving server so we would still need to export and import the databases.I’ll report on how I manage to get everything sorted out.
Thank you
Hello,
We decided to install everything from scratch on a new server.
We’ve exported and imported all content to the new site and are now ready to change dns
How can we set a redirect from en.topic1.com to topic1.com/en ?
I’ve googled for a few hours and found a few solutions, but none seem to workHere is one of the solutions I found that was actually published by you
http://ww.wp.xz.cn/support/topic/convert-subdirectories-to-subdomains?replies=18
# SubDomains RewriteCond %{HTTP_HOST} ^subsite.domain.tld [OR] RewriteCond %{HTTP_HOST} ^www.subsite.domain.tld RewriteRule ^(.*)$ http://domain.tld/subsite/$1 [R=301,L]Here are the current htaccess rules
# BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{HTTP_HOST} ^en.topic1.com [OR] RewriteCond %{HTTP_HOST} ^www.en.topic1.com RewriteRule ^(.*)$ http://topic1.com/en/$1 [R=301,L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] # END WordPressDo I also have to create a subdomain on the new server Cpanel?
I’ve actually tried to do so, but had no luck in getting the redirect to work.Thank you
How can we set a redirect from en.topic1.com to topic1.com/en
That would be done in .htaccess and yes the code I gave in that other post still works, and no you don’t have to actually make a subdomain for it to work 😉
Lesson #1: ALWAYS put the WP calls at the bottom.
Lesson #2: Always separate your .htaccess sections.
So use this:
#Subdomains RewriteCond %{HTTP_HOST} ^en.topic1.com [OR] RewriteCond %{HTTP_HOST} ^www.en.topic1.com RewriteRule ^(.*)$ http://topic1.com/en/$1 [R=301,L] # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] # END WordPressI still can’t get it to work.
Can it be because we moved server and installed all fresh, then imported all wordpress content and set up all the plugins.
What I mean is, is it possible I don’t have the subdomains set up in cpanel and thus there is nothing from which to redirect?the websites are en.meetitalia.org that now should go to meetitalia.org/en/
thank you
What I mean is, is it possible I don’t have the subdomains set up in cpanel and thus there is nothing from which to redirect?
Possibly, and that’s something to ask HostGator. You may want to try manually making en.meetitalia.org point to wherever meetitalia.org is installed. You don’t want to map the subdomain to the /en/ folder, but to the main HTML one for Multisite.
Adding a subdomain solved the issue.
Here is a guide for other users
If you want to move from subdomain (en.topic1.com) to subfolder (topic1.com/en/) set the redirects with the following code in htaccess (code was provided by Ipstenu (Mika Epstein)).Lesson #1: ALWAYS put the WP calls at the bottom.
Lesson #2: Always separate your .htaccess sections.
# Subdomains RewriteCond %{HTTP_HOST} ^en.topic1.com [OR] RewriteCond %{HTTP_HOST} ^www.en.topic1.com RewriteRule ^(.*)$ http://topic1.com/en/$1 [R=301,L] # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] # END WordPressWait a couple of hours as it did not work immediately.
If you are on the same server as the subdomains (en.topic1.com) was hosted you should have everything redirected.
If you are on a new server you must add a subdomain or the server will not know that for example en.topic1.com exists and will serve a 404
To do so, in cPanel, go to subdomains and create a subdomain pointing to the document root of the folder where the htaccess is. This will be the same folder which contains all the files for topic1.comIt should now work.
As a practical example, if anyone goes to http://en.meetitalia.org/travel-phrases/travel-phrases-1-ciao-hello/ he will be redirected to
http://meetitalia.org/en/travel-phrases/travel-phrases-1-ciao-hello/remember that you must repeat the above steps for all subdomains you had on your previous installation.
And remember to thank Ipstenu (Mika Epstein) as it was her help that got me this far.
Hello,
Of the topics I found on the forum this one seems to come closest to my needs and current situation. I’m not sure if the topic is still open however since it was resolved recently.
My situation differs from the above in that way that I wanted to move 5 existing subdomains on a multisite install to subdirectories, YET ON THE EXISTING SERVER and preferably on the EXISTING WP MULTISITE INSTALL. What I planned to do after backing up all content and data, is NOT to export all posts, yet to change all URL’s of existing databases new sites (with subdirectories) with the script, adapt the htaccess and create redirects for the old subdomains, pointing to the newly created subfolders.
I have the following questions before proceding with the above mentioned steps:
– If I change subdomain install to false, will the subdomains and the site actually still be active as such? In other words can I run this operation in parallel?
– If not I can I avoid downtime?
– Can I keep using the multisite install?
– Do I have to changes prefixes as well and if so, how?Thanks
The topic ‘Transfer multisite subdomain installation to multisite subdirectory format’ is closed to new replies.