How can I setup a 302 or 301 redirect from a subdomain to an external site?
-
@subtlecourage just set the refresh to "0" and you shouldn't even see that.
Or change the color of the page.
-
@subtlecourage ..or prep a nice subliminal message ;-]
-
@subtlecourage said in How can I setup a 302 or 301 redirect from a subdomain to an external site?:
@robi
HAHAHAHAThats an excellent idea.
Thanks for clicking, dont forget to buy everything!!
"Teleportation occurring please hold on..."
-
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.
-
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.
-
@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
-
@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? -
@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.
-
@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.
@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