WordPress – Domain mapping subdirectory to external domain

directorydomain-name-systemsubdomainWordpress

I'm running a WordPress multisite install where the blogs are created in subdirectories – e.g. www.mydomain.com/blog1, www.mydomain.com/blog2

I need to clarify what I think is and isn't possible with domain mapping so that clients can use their own domain (and therefore improve their SEO) for the blog.

What I want in an ideal world is for www.clientdomain.com/blog to serve the respective WordPress blog (e.g. www.mydomain.com/blog6) BUT as far as the user is concerned, they are looking at www.clientdomain.com/blog.

I know this is possible with subdomain mapping (e.g. I can serve www.mydomain.com/blog6 as blog.clientdomain.com) but is there any solution for making a subdirectory of one domain serve a website on another domain?

I don't think this is possible without using 301 redirects in .htaccess but just need someone to confirm this for me.

In summary, I believe my options are:

  1. User types www.clientdomain.com/blog and browser loads www.mydomain.com/blog6 (address bar also shows www.mydomain.com/blog6) using .htaccess redirect 301.

  2. User types blog.clientdomain.com and browser loads www.mydomain.com/blog6 (address bar remains blog.clientdomain.com) using domain mapping DNS.

For more information, hosting for wordpress multisite and client website is completely different and client website will have a "normal" site plus email in addition to their blog.

Thanks for your help.

Best Answer

You need need to add an vserver with the document root set to the root of the blog (say for example /var/www/blog6) and the vserver name to blog.clientdomain.com. That should do what you want.


Edit

What you are really looking for is a reverse proxy. With reverse Proxying you can let the server resolve a path (for example /blog) from another server.

+--------+   Request   +--------------------+   Request    +--------------------+
| Client |-----------> | Server domain1.com |------------->| Server domain2.com |
+--------+    /blog    +--------------------+   /blog6     +--------------------+
Related Topic