WP Alias Domains
-
@girish I need alias subdomains for WP dev apps.
I have tested domain aliases in a wordpress app, but it seems to work like a redirect. Switch to the original domain.
Imagine I have a page on a main domain, for example: mydomain.com
I have set up the subdomain alias: sub.mydomain.com
I want that if I visit sub.mydomain.com/page1 it is actually displaying mydomain.com/page1 ibut without changing the domain in the browser, I want it to continue seeing sub.mydomain.com/page1
Right now if I visit sub.mydomain.com/page1 it redirects me to mydomain.com/page1 and I don't want that.
Can I explain myself well? Basically what I want is to create subdomains that lead to the main domain but do not change the domain in the browser. I want it to be a pure alias.
It's possible?
Thank you!
-
@mdreira WP dev app supports multi site. have you checked if your setup is supported by WP multisite - https://docs.cloudron.io/apps/wordpress-developer/#multisite ? In general, having domain aliases only works if the app itself can support it. For example, all the links inside the page etc will still be wrong if we do some simple nginx level alias setup.
-
@girish I have to check if all my plugins support WP MU.
Normally, if I create a subdomain within WP MU, it creates a new sub site, but I don't want that. I just want one main site. What I would like is to use it, as if it were a normal WP but alias domains working in Cloudron.
Is it possible to create subdomains without creating the sub sites within WP MU ?. I don't know if this is possible.
As you already know, the result I want is that an alias domain does not change to the main domain in the browser. If WP MU can do it with cloudron without having to create new sub sites, it is just the solution I need.
-
@mdreira yes, this is already possible. Install WP Dev package and you can add aliases in the Location view. It is not needed to convert WP to multisite.
But what would WP_HOME and WP_SITEURL be set to when multiple domains point to same WP install ?
-
@girish I don't understand why, but this works perfectly on a fresh install of WP dev, but not on the rest.
Could it be that some plugin interferes with the alias? I'm going to try to deactivate plugins to see if that's what it is.
Edited:
I disabled all plugins and it remains the same. We have redirect and protection plugins so I thought it might interfere. Nothing of that.I have started to investigate and I have realized one thing. At first we used WP managed apps and then we moved on to WP developer.
What we did was export each WP managed installation with WP all in one migration plugin. Then we import every one with that plugin into a WP developer app, so we never really use a clean install of WP developer.
Is it possible that this has to do with some configuration that prevents alias domains from working?
-
@mdreira said in domain alias (not redirect):
At first we used WP managed apps and then we moved on to WP developer.
What we did was export each WP managed installation with WP all in one migration plugin. Then we import every one with that plugin into a WP developer app, so we never really use a clean install of WP developer.
Is it possible that this has to do with some configuration that prevents alias domains from working?I don't know.
But if so this is (potentially) just yet another example of Cloudron's Managed WP package resulting in unnessary confusion and more support tickets, wasting everyone's time.
IMHO the managed package shouldn't exist.
-
@girish I already figured out what makes aliases not work in Wordpress dev.
Within WP, in the Settings / Reading menu when I select a static page to be the home page of the web, the alias domains stop working. As soon as I reconfigure that the home page of the web is the list of blog articles, the aliases works again.
Is it possible to fix this?
-
@girish Sorry, I missed answering your question. The home page of all aliases must be the same as the main domain, of course.
Now, alias domains work fine if the blog page is selected as the home page in the main domain. If a static page is selected, the alias domains stop working.
I need this to work because it is a capability that my clients need a lot.
-
This post is deleted! -
girish
-
girish
-
@mdreira said in WP Alias Domains:
Now, alias domains work fine if the blog page is selected as the home page in the main domain. If a static page is selected, the alias domains stop working.
WP in general only supports one domain (in non-multisite mode). They have variables like
WP_HOME
andWP_SITEURL
and these can only be set to one domain. Do you have experience with running WP with multiple domains outside Cloudron? What are those values set to when multiple domains point to the same WP install? Does one write some custom php and change those values dynamically? -
I just got it @girish. In short, the only place where the alias cannot work is on the home page, but it does work on all other pages.
Sorry, I had only tested the home page, but not others. This works for me perfectly.
The issue I have found is that the alias breaks the page design that I make with our page builder.
I think it may be a problem with the plugin with which we build the pages, so I'm going to check with them first.
-
@mdreira sounds good! let us know what you find.