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


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Wordpress www.mydomain.com redirects to mydomain.com

    WordPress (Developer)
    5
    17
    755
    Loading More Posts
    • 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.
    • H
      hav81 last edited by

      Hello everyone, I'm new to the forum. I'installed wordpress in cloudron and set it up for www.mydomain.com. when web surfing for www.mydomain.com, i get automatic redirected to mydomain.com. this causes google to report redirect error. Could you point me on how to cancel this redirect. Thanks in advance.

      M girish xaddison 3 Replies Last reply Reply Quote 0
      • M
        msbt App Dev @hav81 last edited by

        @hav81 this could be either, your WordPress setup which redirects to non-www and Cloudron is trying to redirect back or the other way around. You should check your .htaccess file and the wp-options table of your WP installation.

        H 2 Replies Last reply Reply Quote 0
        • humptydumpty
          humptydumpty last edited by humptydumpty

          In Cloudron, go to the app settings --> location. Type WWW in that field. Then, create a new redirect and keep it empty so that the bare domain gets redirected to www.

          H 1 Reply Last reply Reply Quote 2
          • H
            hav81 @humptydumpty last edited by

            @humptydumpty , I have www configured in the Location. Before I had in the aliases configured the root, I've deleted this and add it as suggested in the redirect. Same problem, when i go on the web for the www.mydomain.com, or mydomain.com, both takes me to mydomain.com. if you have other ideas let me know. Thanks

            1 Reply Last reply Reply Quote 0
            • H
              hav81 @msbt last edited by

              @msbt Thanks for the suggestion, I'm a novice with htaccess, how can I see if this is the problem? Thanks

              humptydumpty 1 Reply Last reply Reply Quote 0
              • H
                hav81 @msbt last edited by

                @msbt thanks for your feedback, I'm new with web hosting, what do i need to check in the htacess and where to access it? Also in the wp-option, how can I acess it? I have only installed Cloudron and Wordpress on the server. Thanks

                1 Reply Last reply Reply Quote 0
                • humptydumpty
                  humptydumpty @hav81 last edited by

                  @hav81 you can access the htaccess file using the file manager when you go into the app's settings in your cloudron. Go into the PUBLIC folder and htaccess is right there.

                  Screenshot 2021-11-29 101243.png

                  H 1 Reply Last reply Reply Quote 1
                  • girish
                    girish Staff @hav81 last edited by

                    @hav81 Did you import an existing WordPress from elsewhere or is this a fresh installation? If it's imported, then was your previous site was located at mydomain.com ?

                    H 1 Reply Last reply Reply Quote 1
                    • H
                      hav81 @humptydumpty last edited by

                      @humptydumpty, thanks, i learned a new thing, so here is my htaccess file
                      Do you see something that cases the redirect from www.mydomain.com to mydomain.com?

                      BEGIN WordPress

                      Directivele (liniile) între „BEGIN WordPress” și „END WordPress” sunt

                      generate dinamic și ar trebui modificate numai prin filtrele WordPress.

                      Toate modificările la directivele cuprinse între acești marcatori vor fi suprascrise.

                      <IfModule mod_rewrite.c>
                      RewriteEngine On
                      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
                      RewriteBase /
                      RewriteRule ^index.php$ - [L]
                      RewriteCond %{REQUEST_FILENAME} !-f
                      RewriteCond %{REQUEST_FILENAME} !-d
                      RewriteRule . /index.php [L]
                      </IfModule>

                      END WordPress

                      1 Reply Last reply Reply Quote 0
                      • H
                        hav81 @girish last edited by

                        @girish thanks for the question
                        I've purchased a server on linode.
                        On that server I've installef cloudron.
                        Then in my cloudron i've installed a fresh wordpress developer module.
                        Let me know if I can provide more info to support to figure out why there is a redirect.

                        girish 1 Reply Last reply Reply Quote 0
                        • girish
                          girish Staff @hav81 last edited by

                          @hav81 the htaccess file looks like the standard one. Can you send the real domain name to support@cloudron.io and I can try to see if we see the same behavior from the outside ?

                          H 1 Reply Last reply Reply Quote 0
                          • xaddison
                            xaddison @hav81 last edited by

                            @hav81 I had this problem too and I lost my config but I was having luck with using the multi-site enabled with sub-domain however I did not use the root of the sub-domain.

                            It was:

                            wp.mydomain.com => set as the app in Cloudron primary URL
                            used for setup, plugins, users but no real site was here

                            then add a subdomain on top of:
                            devsite1.wp.mydomain.com => set as a redirect in Cloudron App
                            devsite2.wp.mydomain.com => set as a redirect in Cloudron App

                            In WP MultiSite I set the URLs to the virutal folders:

                            /wp
                            /wp/devsite1
                            /wp/devsite2

                            For Prod I then had planned on cloning and doing another entry with both:

                            www.someotherdomain.com www.whatsNot.app (E.G)
                            and whatsNot.app as additional redirects and set to a cloned new /wp/whatsnotapp/

                            Maybe something like this can be included in the App as an option in setup. I only had to change the two things already mentioned

                            Multisite = true in wp-config and then .htaccess.

                            It was easier to map the virutal folders to /media so you could see what was going on as well.

                            1 Reply Last reply Reply Quote 0
                            • H
                              hav81 @girish last edited by

                              @girish hello, i've just sent now a email as requested with the info. Thanks

                              girish 1 Reply Last reply Reply Quote 0
                              • girish
                                girish Staff @hav81 last edited by

                                @hav81 thanks for sending across the info. I think in your case what is happening is the reverse of what you said.

                                • If I visit www.domain.com, it is still on www.domain.com .
                                • If I visit domain.com, it redirects to www.domain.com .

                                I suspect the source of your confusion is Google Chrome URL bar. Google chrome drops the www when it displays the location 😕 Please see https://www.bleepingcomputer.com/news/google/google-chrome-hides-www-and-https-in-the-address-bar-again/ . If you click on the URL, you will see that it is www.domain.com.

                                Here is your site, after I visited www.domain.com:

                                5ffa26f7-04df-4030-8344-a3a6139fd178-image.png

                                I then click the URL bar, I see the www and https:

                                3f892678-0f4a-409b-9415-05dd1fb1bbdd-image.png

                                The behavior is better in Firefox.

                                H 1 Reply Last reply Reply Quote 2
                                • H
                                  hav81 @girish last edited by

                                  @girish , thanks a lot you are 100% right, I was tricked by Chrome.
                                  Many thanks

                                  girish 1 Reply Last reply Reply Quote 1
                                  • girish
                                    girish Staff @hav81 last edited by

                                    @hav81 there was a bug in the code as well where removing a "redirect" was causing a crash. I have fixed this now - https://git.cloudron.io/cloudron/box/-/commit/cefbe7064f4c7b31fb93bbf7ed85bf916aa5cf39

                                    H 1 Reply Last reply Reply Quote 2
                                    • H
                                      hav81 @girish last edited by

                                      @girish sorry for the long delay in answer, many many thanks

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post
                                      Powered by NodeBB