Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. WordPress (Developer)
  3. WP Alias Domains

WP Alias Domains

Scheduled Pinned Locked Moved Solved WordPress (Developer)
18 Posts 6 Posters 4.0k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mdreiraM mdreira

    @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?

    jdaviescoatesJ Offline
    jdaviescoatesJ Offline
    jdaviescoates
    wrote on last edited by
    #6

    @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.

    I use Cloudron with Gandi & Hetzner

    mdreiraM 1 Reply Last reply
    0
    • jdaviescoatesJ jdaviescoates

      @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.

      mdreiraM Offline
      mdreiraM Offline
      mdreira
      translator
      wrote on last edited by
      #7

      @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?

      1 Reply Last reply
      0
      • girishG girish

        @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 ?

        mdreiraM Offline
        mdreiraM Offline
        mdreira
        translator
        wrote on last edited by
        #8

        @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.

        mdreiraM girishG 2 Replies Last reply
        0
        • mdreiraM mdreira

          @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.

          mdreiraM Offline
          mdreiraM Offline
          mdreira
          translator
          wrote on last edited by
          #9
          This post is deleted!
          1 Reply Last reply
          0
          • girishG girish moved this topic from Support on
          • girishG girish referenced this topic on
          • mdreiraM mdreira

            @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.

            girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by girish
            #10

            @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 and WP_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?

            mdreiraM 1 Reply Last reply
            0
            • girishG 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 and WP_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?

              mdreiraM Offline
              mdreiraM Offline
              mdreira
              translator
              wrote on last edited by
              #11

              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.

              girishG 1 Reply Last reply
              0
              • mdreiraM mdreira

                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.

                girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #12

                @mdreira sounds good! let us know what you find.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  adpiadmin
                  wrote on last edited by
                  #13

                  Hi, I'm having a similar problem as this one. I'm attempting to move a WordPress site from a server managed with Serverpilot to Cloudron. As is the case mentioned above, individual pages work fine using an alias, but the home page gets redirected to the main website URL.
                  To get it to work on the Serverpilot server, I modified the wp-config to have the following:
                  define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);
                  define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);

                  It looks like Cloudron changes these back to the main site URL each time an alias is added. However, I tried manually changing it back to the entries above and still had the same problem with the home page.

                  More details:
                  The WordPress (developer) site in Cloudron is configured for sites.topleveldomain.org. I added an alias for mobilebayarea.topleveldomain.org. Going to mobilebayarea.topleveldomain.org/connect works fine. Going to mobilebayarea.topleveldomain.org redirects to sites.topleveldomain.org. I need it to work using mobilebayarea.topleveldomain.org for the home page just like the other pages. I've got code in the theme files that loads content based on the subdomain used to access the site. This has been working well on the Serverpilot server so I know it is possible but something in Cloudron is messing up the home page.

                  Any ideas on how to fix?
                  Thanks

                  nebulonN 1 Reply Last reply
                  0
                  • A adpiadmin

                    Hi, I'm having a similar problem as this one. I'm attempting to move a WordPress site from a server managed with Serverpilot to Cloudron. As is the case mentioned above, individual pages work fine using an alias, but the home page gets redirected to the main website URL.
                    To get it to work on the Serverpilot server, I modified the wp-config to have the following:
                    define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);
                    define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);

                    It looks like Cloudron changes these back to the main site URL each time an alias is added. However, I tried manually changing it back to the entries above and still had the same problem with the home page.

                    More details:
                    The WordPress (developer) site in Cloudron is configured for sites.topleveldomain.org. I added an alias for mobilebayarea.topleveldomain.org. Going to mobilebayarea.topleveldomain.org/connect works fine. Going to mobilebayarea.topleveldomain.org redirects to sites.topleveldomain.org. I need it to work using mobilebayarea.topleveldomain.org for the home page just like the other pages. I've got code in the theme files that loads content based on the subdomain used to access the site. This has been working well on the Serverpilot server so I know it is possible but something in Cloudron is messing up the home page.

                    Any ideas on how to fix?
                    Thanks

                    nebulonN Offline
                    nebulonN Offline
                    nebulon
                    Staff
                    wrote on last edited by
                    #14

                    @adpiadmin not 100% sure if this is what you want, but Cloudron supports domain alias as well for apps, not just redirects. It sounds like this is what you are looking for? https://docs.cloudron.io/apps/#aliases

                    A 1 Reply Last reply
                    0
                    • nebulonN nebulon marked this topic as a question on
                    • nebulonN nebulon

                      @adpiadmin not 100% sure if this is what you want, but Cloudron supports domain alias as well for apps, not just redirects. It sounds like this is what you are looking for? https://docs.cloudron.io/apps/#aliases

                      A Offline
                      A Offline
                      adpiadmin
                      wrote on last edited by
                      #15

                      @nebulon Thanks, but I'm already using aliases. The aliases work fine except for the home page of the WordPress site. As mentioned in my prior post, if I attempt to go to aliasname.topleveldomain.org/somepage, that works fine. The browser stays at aliasname.topleveldomain.org/somepage. However, if I attempt to go to aliasname.topleveldomain.org, it gets redirected to the main location url (sites.topleveldomain.org in my case).

                      A 1 Reply Last reply
                      0
                      • A adpiadmin

                        @nebulon Thanks, but I'm already using aliases. The aliases work fine except for the home page of the WordPress site. As mentioned in my prior post, if I attempt to go to aliasname.topleveldomain.org/somepage, that works fine. The browser stays at aliasname.topleveldomain.org/somepage. However, if I attempt to go to aliasname.topleveldomain.org, it gets redirected to the main location url (sites.topleveldomain.org in my case).

                        A Offline
                        A Offline
                        adpiadmin
                        wrote on last edited by
                        #16

                        @adpiadmin I think I got this working. It seems that there is something in the WordPress code that doesn't like having hardcoded WP_HOME and WP_SITEURL values if you also have WordPress set to a static home page. Cloudron resets the WP_HOME and WP_SITEURL values each time you add an alias. I changed WordPress to not use a static home page and modified the index.php in our theme file to handle redirecting requests to / to /home (a static page).

                        girishG 1 Reply Last reply
                        2
                        • P Offline
                          P Offline
                          privsec
                          wrote on last edited by
                          #17

                          I have a staging instance that I use for every WP site I support

                          I set up the main site first and then clone a backup of it to dev.domain.com

                          This way I can test out major edits on the dev branch first.

                          1 Reply Last reply
                          1
                          • A adpiadmin

                            @adpiadmin I think I got this working. It seems that there is something in the WordPress code that doesn't like having hardcoded WP_HOME and WP_SITEURL values if you also have WordPress set to a static home page. Cloudron resets the WP_HOME and WP_SITEURL values each time you add an alias. I changed WordPress to not use a static home page and modified the index.php in our theme file to handle redirecting requests to / to /home (a static page).

                            girishG Offline
                            girishG Offline
                            girish
                            Staff
                            wrote on last edited by
                            #18

                            @adpiadmin ah cool, I will mark this as solved then.

                            1 Reply Last reply
                            0
                            • girishG girish has marked this topic as solved on
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Bookmarks
                            • Search