-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting primary domain #3
Comments
As of WP 3.9+, you can set the URL to basically anything you want to change the "primary" site (you could then alias the old one back). Not sure if that fits your use case though? (I do want to add this, but still working out the UI.) |
Your solutions "works", only if the primary domain is also added as an alias. No permanent redirection occurs though. |
Strange that it needs to be added as an alias. Right now, it doesn't handle redirects simply because the code to change those hasn't been written yet. :) I definitely want to handle this one, just haven't gotten to it yet. |
Yes I thought it was strange too. I have set up a redirect at the server level for now. Thanks for contributing this work!= |
I am a little confused by this exchange. I am wondering if it is possible to do the following. I have site, site.example.com. Have three aliases, www.example.com, server1.exaple.com and server2.example.com. www.example.com is the main and public domain of the site., I also want to be able hit the site at server1.example.com, without it redirecting to www.example.com. This would help as I am running a multisite over multiple servers and need wordpress to respond to whatever url I give it. |
So, here's the question: what would you want primary domains to do? Is the idea that other aliases would set up canonical redirects to the main domain? #28 changed the behaviour to use the alias instead, so if you have Is there a use case for having all domains redirect to the primary one? For my own use cases, I'd like to have all mapped domains redirect to the primary but with exceptions (the original subdomain, in my case). Are there any other use cases we need to handle here? |
+1 for this. If we look at how wordpress.com handles this. For the most part aliases map over to the primary domain, except in cases where you are accessing the dashboard. In an SSL context on multisite, where the subdomain is protected by a wildcard certificate, but the mapped domains may not have individual certificates, redirecting back to the unmapped domain on login and admin calls solves the "unsafe content ahead" errors in the browser when logged in users are attempting to manage their site; but ensures the audience is always taken to the mapped domain, rather than the unmapped subdomain. |
+1 for adding the option to 301 all aliases to a single "canonical" domain. |
Chiming in as I think this is referencing an issue we have run into as well. Would adding this option in take care of the sites having "duplicate" content once live, meaning once a domain is mapped, or aliases, then the original subdomain the site was built on would no longer be used and redirect to the mapped domain? |
"Duplicate content" probably isn't the right way to describe it. There is only one instance of the content (posts, pages, etc). Think of it more like two doors to the same house. Once you are in the house, it's all the same. One door (the mapped domain) is well lit, with a beautiful garden, and welcoming awning. The other door (the unmapped domain) is ugly, still has the contractors name on it, and there's building material stacked around the entrance. Right now people come in both doors and we can't control the traffic. We need a bouncer who forces everyone to the first door: "move along, nothing to see here at this ugly back door". |
For the record, this is a duplicate content issue in SEO terms. If nothing exists to reference the single canonical resource, you will have indexation problems. Using the A big part of why this is an issue is that links in serialized content, such as widgets or certain custom fields, will never get updated by default. To replace all instances of them you would need to use either an automated script via WP CLI or a tool like this. When you have both duplicate copies of a site AND links to said copies, then you can wind up causing yourself some pretty serious SEO problems. This is especially true if for some reason the root domain of the network gets penalized or de-indexed for some reason. If that happens, all the sites on the network with links pointing to and originating from the root domain can be negatively affected. |
Ahhh. That makes sense, and suddenly adds a greater sense of urgency. I hadn't looked at it that way before. |
Yea what Rob said. Google indexes all the subdomain "staging site" urls and sees hundreds of them in same subdomain on multisite install, all sites in same niche market as well so we are slammed lol I have been running wp-cli search replace recursive to change all subdomain a to mapped domain once "live" but that gets cumbersome, especially iterating over several hundred sites to do it... |
Do we think this is something that will be addressed soon? |
I think I'm going to look into this today. My goal is simple here, which is to simply hook into the template_redirect action and check if you are visiting a domain that has a "mapped alias set" and redirect you (301) to the alias thats active. This will resolve 2 things:
|
also noting its an issue on this endpoint, which lists "my sites" with bad links to subsites instead of aliases. |
Any luck @scarstens ? Would love to move back to Mercator, I have a new network to setup which needs to be all https and the current mapping plugin wont do that very well. |
@thatryan I only partially solved the problem (just enough that we could use mercator on our local VVV installs). you are welcome to chat me on WordPress core slack and I can tell you where we are at exactly. Also none of my PR's have been handled here, so all my updates are only available at https://github.com/fansided/Mercator |
@davisshaver so we opted to use WPs built in handling for setting the primary domain, that is to set the The Front end redirection issues we can handle in https://github.com/humanmade/Mercator-Redirect |
Have you thought about allowing a primary domain to be set? This is a major feature of the existing solution and seems like it'd be useful to incorporate into Mercator as well.
The text was updated successfully, but these errors were encountered: