3

I am using Worspress Multisite feature, where I have two domains:

lkrnac.net -> main domain

handysvandy.net -> secondary domain

Not using any special plugin to handle multiple domains.

In Network Admin area I have two sites registered with two mentioned domains. Also have "Path" set to root ("/") for each site and checked "Update siteurl and home as well" check box.

Everything works generally fine. The only problem is that when image is uploaded for secondary domain (handysvandy.net), it is uploaded and served from main domain (example: http://handysvandy.net/2014/06/12/dandelion-and-parsley-salad/).

What should I do to have images served from and uploaded to secondary domain?

EDIT - source

I followed this blog to set up domains for multisite: http://kaspars.net/blog/wordpress/wordpress-multisite-without-domain-mapping

EDIT2 - example links

Post

Images

EDIT3 - new fact

After usage of "Velvet Blues Update URLs" plugin that replaces domain for images, images are served from correct URL. So it looks like issue during image uploading.

  • That method works, but is incomplete. WordPress does not properly support multiple domains with multisite yet. You can trick it into working, but only just. Use a domain mapping plugin instead. It's not difficult. – Otto Oct 5 '14 at 13:56
  • I used that plugin half a year ago, but this method was more stable for me. I believe there were problems with admin access for secondary domain users. – luboskrnac Oct 5 '14 at 18:31
  • I use one of those plugins myself, and wrote the tutorial for how to use it ages ago. It works fine, still, and has no such problems like you are describing. – Otto Oct 5 '14 at 18:49
  • It works fine for me with about eight blogs running on a setup like that. Images get uploaded to their appropriate folders: /wp-content/uploads/sites/9, /wp-content/uploads/sites/8, etc. – Kaspars Oct 6 '14 at 8:03
  • @Kaspars, this works for me also. My problem is that link to image in post is pointing to main domain (see EDIT2 in question). Can access image via both domains. – luboskrnac Oct 6 '14 at 8:40
1

never saw this hack before, but that is all it is - a hack. While it might work at some situations, wordpress core do not officially supports (yet) having two domains on one network install, and therefor YMMV to what will work and what not. You are much safer having two different installs then taking this path.

  • It's not a hack: codex.wordpress.org/… – luboskrnac Oct 5 '14 at 18:28
  • @lkrnac, If you know better then otto and me why do you bother asking this question at all? Wordpress is open source, read the source and debug it and you will find why it doesn't work by yourself. – Mark Kaplun Oct 5 '14 at 18:43
  • It is a hack. It will sorta work, but it is not supported. In the future, when WordPress adds proper support for this, it may work better. For now, use a plugin. – Otto Oct 5 '14 at 18:49
  • I followed this tutorial to set up plugin: fronterahouse.com/blog/…. The behavior with images is the same. As bonus SEO plugin by Yoast is now somehow corrupted. Turning the hack back on... – luboskrnac Oct 6 '14 at 6:11
0

I have tried this approach to domain mapping (as outlined by Ipstenu & Andrea Rennick in Multisite 110) with image/content uploads behaving as expected, so you may have some additional issue going on...

You should be able to set UPLOAD_PATH and/or UPLOAD_URL_PATH per subsite from wp-admin/options.php

Another option might be setting WP_CONTENT_DIR and/or WP_CONTENT_URL in wp-config...

You could try using (alter to suite)

    define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-content' );
    define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.