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 Avoid multiple redirects when using www.

    Feature Requests
    3
    6
    181
    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.
    • marcusquinn
      marcusquinn last edited by marcusquinn

      Since Cloudron is handling the redirects, I don't think it would be efficient to do in the .htaccess for every site.

      Based on this Google Pagespeed report for http://marcusquinn.com which will be the first try for anyone typing in a domain:

      • https://developers.google.com/speed/pagespeed/insights/?url=marcusquinn.com&tab=mobile&hl=en_GB

      67e8eee5-2dc6-4489-8423-cd3cf1f240c0-image.png

      e799ac5f-6e84-449f-a3d9-59bb7f9f02cb-image.png

      Compared to:

      • https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fwww.marcusquinn.com%2F&hl=en_GB

      5d8360cb-feca-4353-a18e-69b1c4e9be7c-image.png

      In reference to these articles:

      • https://www.yes-www.org/why-use-www/
      • https://www.danielmorell.com/guides/htaccess-seo/redirects/https-www-and-trailing-slash
      • https://www.danielmorell.com/guides/htaccess-seo/sample-code/redirect-sample-code#https-www-files

      It seems this generator would be good for the default setup when www. is the Main location:

      • https://www.danielmorell.com/tools/htaccess/redirect-generator

      For example::

      05485f34-449e-4d19-87ab-16f240d61077-image.png

      My website if you're interested in my ramblings on technology too 🙂 :

      • https://www.marcusquinn.com

      Will do a proper write-up post on Cloudron once I'm happy with my setup 😉

      We're not here for a long time - but we are here for a good time :)
      Jersey/UK
      Work & Ecommerce Advice: https://brandlight.org
      Personal & Software Tips: https://marcusquinn.com

      1 Reply Last reply Reply Quote 2
      • girish
        girish Staff last edited by

        Good point. If i understand correctly, you want http://foo.com to redirect to https://www.foo.com directly. FWIW, because of redirect caching + HSTS this just a one time thing (atleast for that user+browser)

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

          @girish Yes please 🙂 Same principles would be equally valuable to those using Ghost / Wordpress / Surfer for their www. site.

          Might be worth a note in the Docs too with a link to the above commentary on the reasons for choosing to use www. as it would help make high-availability multi-Cloudron setups possible, where you can have multiple CNAME IPs for a subdomain but not the naked root domain AFAIK.

          We're not here for a long time - but we are here for a good time :)
          Jersey/UK
          Work & Ecommerce Advice: https://brandlight.org
          Personal & Software Tips: https://marcusquinn.com

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

            I have fixed this for the next release (5.6). Thanks for reporting.

            1 Reply Last reply Reply Quote 1
            • rmdes
              rmdes last edited by

              I simply add www for most apps because too many people are used to type this before reaching their destination.
              But from reading this thread I'm even more confused ?

              I thought dropping www was not such bad idea, a bit a useless remain from when hosting was hard? I may be completely wrong but I really want to understand what's the best thing to do, certainly if it impacts SEO etc...

              marcusquinn 1 Reply Last reply Reply Quote 0
              • marcusquinn
                marcusquinn @rmdes last edited by

                @rmdes I think from a user point of view it just needs to work with either, they don't really care as long as typing results in what they were hoping for. From a Sys Admin point of view, www. is more flexible for scaling and high-availability setups. As an example, if you use Odoo enterprise, it must be www. for the websites.

                We're not here for a long time - but we are here for a good time :)
                Jersey/UK
                Work & Ecommerce Advice: https://brandlight.org
                Personal & Software Tips: https://marcusquinn.com

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