multisite htaccess 301 redirects

Okay, RewriteEngine On RewriteBase / # Blog ID1 Rewrite Rules RewriteCond %{HTTP_HOST} ^(www\.)?primary-domain.co.uk [NC] RewriteRule ^about/careers/$ contact/careers/ [R=301,NC,L] RewriteRule ^glossary.html$ sitemap/ [R=301,NC,L] # Blog ID3 Rewrite Rules RewriteCond %{HTTP_HOST} ^(www\.)?mapped-domain3.co.uk [NC] RewriteRule ^about/$ http://primary-domain.co.uk/about/ [R=301,NC,L] RewriteRule ^news/$ http://primary-domain.co.uk/news/ [R=301,NC,L] This works, there’s 158 more lines to my particular site but you get the idea. I … Read more

How does WordPress connect sites and the wp_users table?

On multisite it’s still a single user table for all websites. It identify user relationship with sites on the table wp_usermeta, under the following user meta keys: wp_x_capabilities wp_x_user_level There are other meta keys for user options. But I guess there is no difference on other meta fields (like name, display name and etc), so … Read more

WP REST API – Multisite – get posts from all sites

Here’s a REST API recipe for latest post per site on a multi-site, for relatively few sites: Use get_sites(), loop over sites and switch to each site, query latest post on each site, collect data, order data by utime, serve data Example REST Routes https://example.com/wp-json/wpse/v1/latest-post-per-site https://example.com/wp-json/wpse/v1/latest-post-per-site?number=10 https://example.com/wp-json/wpse/v1/latest-post-per-site?debug Example Plugin Here’s a demo plugin implementing the … Read more

Transfer Subdomain site to Multisite setup

Assuming sd1.mysite.com and sd2.mysite.com are single WordPress installs. You can create mysite.com as a WordPress Multisite, you can then export the posts, users, etc and reimport to the new multisite version of sd1 or sd2 using: https://en-ca.wordpress.org/plugins/wordpress-importer/ You will need to include the themes, plugins as well in the new multisite install. If sd1.mysite.com and … Read more