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. Support
  3. How can I setup a 302 or 301 redirect from a subdomain to an external site?

How can I setup a 302 or 301 redirect from a subdomain to an external site?

Scheduled Pinned Locked Moved Solved Support
301 redirect302 redirectredirectsubdomainexternal site
26 Posts 11 Posters 4.5k Views 10 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.
  • S subtlecourage

    @fbartels said in How can I setup a 302 or 301 redirect from a subdomain to an external site?:

    Hi @subtlecourage,

    this could be achieved with the surfer app and a simple html. You can read more about it at https://forum.cloudron.io/post/19387.

    @scooke said in How can I setup a 302 or 301 redirect from a subdomain to an external site?:

    @fbartels I hope op will let us know if they tried this or not.

    HUZZAH!! That worked!

    I will have to see how advanced surfer will let me get with site design so it is not as ugly as while background and black text. But this is an AWESOME STARTING POINT!!

    Thanks!

    robiR Offline
    robiR Offline
    robi
    wrote on last edited by
    #8

    @subtlecourage just set the refresh to "0" and you shouldn't even see that.

    Or change the color of the page.

    Conscious tech

    S 1 Reply Last reply
    2
    • robiR robi

      @subtlecourage just set the refresh to "0" and you shouldn't even see that.

      Or change the color of the page.

      S Offline
      S Offline
      subtlecourage
      wrote on last edited by
      #9

      @robi

      It still loads, but for a millisecond.

      I almost would rather a pretty background and better design to load for 5 seconds or so. But I guess ill just have to play with it.

      robiR 1 Reply Last reply
      1
      • S subtlecourage

        @robi

        It still loads, but for a millisecond.

        I almost would rather a pretty background and better design to load for 5 seconds or so. But I guess ill just have to play with it.

        robiR Offline
        robiR Offline
        robi
        wrote on last edited by
        #10

        @subtlecourage ..or prep a nice subliminal message ;-]

        Conscious tech

        S 1 Reply Last reply
        0
        • robiR robi

          @subtlecourage ..or prep a nice subliminal message ;-]

          S Offline
          S Offline
          subtlecourage
          wrote on last edited by
          #11

          @robi
          HAHAHAHA

          Thats an excellent idea.

          Thanks for clicking, dont forget to buy everything!!

          micmcM 1 Reply Last reply
          0
          • S subtlecourage

            @robi
            HAHAHAHA

            Thats an excellent idea.

            Thanks for clicking, dont forget to buy everything!!

            micmcM Offline
            micmcM Offline
            micmc
            wrote on last edited by
            #12

            @subtlecourage said in How can I setup a 302 or 301 redirect from a subdomain to an external site?:

            @robi
            HAHAHAHA

            Thats an excellent idea.

            Thanks for clicking, dont forget to buy everything!!

            "Teleportation occurring please hold on..." 😀

            Ignorance is not an excuse anymore!
            https://AutomateKit.com

            P 1 Reply Last reply
            1
            • micmcM micmc

              @subtlecourage said in How can I setup a 302 or 301 redirect from a subdomain to an external site?:

              @robi
              HAHAHAHA

              Thats an excellent idea.

              Thanks for clicking, dont forget to buy everything!!

              "Teleportation occurring please hold on..." 😀

              P Offline
              P Offline
              privsec
              wrote on last edited by
              #13

              @micmc Oh! Thats Great!

              1 Reply Last reply
              0
              • C Offline
                C Offline
                ccfu
                wrote on last edited by
                #14

                Why not use a LAMP app and .htaccess?

                S 1 Reply Last reply
                1
                • C ccfu

                  Why not use a LAMP app and .htaccess?

                  S Offline
                  S Offline
                  subtlecourage
                  wrote on last edited by
                  #15

                  @ccfu
                  I have never used either.

                  to reinforce the noob, any documentation on that?

                  C 1 Reply Last reply
                  1
                  • S subtlecourage

                    @ccfu
                    I have never used either.

                    to reinforce the noob, any documentation on that?

                    C Offline
                    C Offline
                    ccfu
                    wrote on last edited by ccfu
                    #16

                    @subtlecourage

                    It's very simple. Just spin up a LAMP app with something.mydomain.com as the location. Then, in the file manager create a file .htaccess in the public directory with the following content:

                    # Permanent URL redirect 
                    RewriteEngine on
                    Redirect 301 / https://externaldomain.com/path
                    

                    Any requests to something.mydomain.com will then be forwarded to externaldomain.com/path

                    There is plenty of documentaton on this if you do a Google search for 301 redirect .htaccess. there are also generators that will provide you with the correct code for different scenarios, for example redirecting specific pages.

                    1 Reply Last reply
                    4
                    • T Offline
                      T Offline
                      toxicdorito
                      wrote on last edited by
                      #17

                      Alrighty, so I'm running into this issue night now. I'm trying to setup over 9 different redirects to htmls. Basically, sub1.domain.com connects to domain.com/sub1.html for all of them. This being a setup for redirection generator links. Theoretically, I could create a app for every sub domain, or I could just setup sub-directories for it. But, I am importing a project that is live, so I'm going to have to stick with the sub-domain method. Is there a way to bypass the redirection without making tons of apps? I know I could do a rewrite condition, however that only works when the redirect is made on the site through htaccess. But redirecting it through the panel ensures that you never reach the htaccess under the sub domain and if you don't specify the sub-domain, the web-server never responds to it.

                      T 1 Reply Last reply
                      0
                      • T toxicdorito

                        Alrighty, so I'm running into this issue night now. I'm trying to setup over 9 different redirects to htmls. Basically, sub1.domain.com connects to domain.com/sub1.html for all of them. This being a setup for redirection generator links. Theoretically, I could create a app for every sub domain, or I could just setup sub-directories for it. But, I am importing a project that is live, so I'm going to have to stick with the sub-domain method. Is there a way to bypass the redirection without making tons of apps? I know I could do a rewrite condition, however that only works when the redirect is made on the site through htaccess. But redirecting it through the panel ensures that you never reach the htaccess under the sub domain and if you don't specify the sub-domain, the web-server never responds to it.

                        T Offline
                        T Offline
                        toxicdorito
                        wrote on last edited by
                        #18

                        @toxicdorito I see now, that the LAMP App is missing alias, I'm unsure if that might be the fix, but I think so. All I know is, I can't figure this stuff out 😆

                        nebulonN 1 Reply Last reply
                        0
                        • T toxicdorito

                          @toxicdorito I see now, that the LAMP App is missing alias, I'm unsure if that might be the fix, but I think so. All I know is, I can't figure this stuff out 😆

                          nebulonN Away
                          nebulonN Away
                          nebulon
                          Staff
                          wrote on last edited by
                          #19

                          @toxicdorito yes the alias features + htaccess rewrite using the LAMP app should solve this for you.

                          The LAMP app also has multiDomain and thus alias support. Can you double check in the Location tab of the app configure screen in your Coudron dashboard?

                          T 1 Reply Last reply
                          0
                          • robiR Offline
                            robiR Offline
                            robi
                            wrote on last edited by
                            #20

                            This is also solvable with the Surfer App + aliases and some HTML+JS to redirect incoming subdomains to directory paths/pages.

                            Conscious tech

                            T 1 Reply Last reply
                            1
                            • nebulonN nebulon

                              @toxicdorito yes the alias features + htaccess rewrite using the LAMP app should solve this for you.

                              The LAMP app also has multiDomain and thus alias support. Can you double check in the Location tab of the app configure screen in your Coudron dashboard?

                              T Offline
                              T Offline
                              toxicdorito
                              wrote on last edited by
                              #21

                              @nebulon f40b59ba-fcef-46fa-8cdd-c42a407a181a-image.png This is all that I see under LAMP, All of the LAMP packages do not show alias for some reason.

                              1 Reply Last reply
                              0
                              • robiR robi

                                This is also solvable with the Surfer App + aliases and some HTML+JS to redirect incoming subdomains to directory paths/pages.

                                T Offline
                                T Offline
                                toxicdorito
                                wrote on last edited by
                                #22

                                @robi And see, I've done this in the past. Same with running Kutt and simply making short links using the domains needed. However, I will need LAMP for my setup.

                                nebulonN 1 Reply Last reply
                                0
                                • T toxicdorito

                                  @robi And see, I've done this in the past. Same with running Kutt and simply making short links using the domains needed. However, I will need LAMP for my setup.

                                  nebulonN Away
                                  nebulonN Away
                                  nebulon
                                  Staff
                                  wrote on last edited by
                                  #23

                                  @toxicdorito oh actually I see, the alias feature will only be shown with the next release. I was looking at my developer instance which has current master branch version. So then it will be fixed with the next Cloudron version.

                                  1 Reply Last reply
                                  0
                                  • girishG Offline
                                    girishG Offline
                                    girish
                                    Staff
                                    wrote on last edited by
                                    #24

                                    I am probably missing something. Support for multi domain/aliases is already in Cloudron 7.

                                    36396f8d-fc12-4a8c-a545-d0b4269895b8-image.png

                                    @toxicdorito What is the version of your Cloudron ? The latest lamp package already has support for aliases -

                                    jdaviescoatesJ 1 Reply Last reply
                                    1
                                    • nebulonN Away
                                      nebulonN Away
                                      nebulon
                                      Staff
                                      wrote on last edited by
                                      #25

                                      Sorry I actually looked into the wrong place, I happened to look at a previous LAMP app package which didn't have the multidomain flag set. @toxicdorito which LAMP app verison have you installed?

                                      1 Reply Last reply
                                      0
                                      • girishG girish

                                        I am probably missing something. Support for multi domain/aliases is already in Cloudron 7.

                                        36396f8d-fc12-4a8c-a545-d0b4269895b8-image.png

                                        @toxicdorito What is the version of your Cloudron ? The latest lamp package already has support for aliases -

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

                                        @girish said in How can I setup a 302 or 301 redirect from a subdomain to an external site?:

                                        I am probably missing something. Support for multi domain/aliases is already in Cloudron 7.

                                        36396f8d-fc12-4a8c-a545-d0b4269895b8-image.png

                                        @toxicdorito What is the version of your Cloudron ? The latest lamp package already has support for aliases -

                                        What if we want to create an alias or redirect for our dashboard domain?

                                        I want https://my.ud.coop to redirect to https://my.uniteddiversity.coop, see https://forum.cloudron.io/post/44785

                                        I use Cloudron with Gandi & Hetzner

                                        1 Reply Last reply
                                        0
                                        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