YunoHost-Apps / wordpress_ynh

WordPress package for YunoHost
https://wordpress.org/
GNU General Public License v3.0
26 stars 30 forks source link

Solution for redirecting from main domian to subdomian #22

Closed anmol26s closed 6 years ago

anmol26s commented 7 years ago

Hi As Wordpress can not be installed on the Yunohost main domian (in most cases it would be domain.tld), the ideal condition would be to install Wordpress on the subdomain (that would be www.domian.tld in most of the cases). But installing on the subdomain raises a condition where the domian.tld should redirect to www.domian.tld excluding the links to domian.tld/yunohost/sso and for the app installed on the main domian for eg. domain.tld/webmail would be liking to roundcube. This require changes in the nginx to work properly. Can you please provide me with an example for the nginx config files so that domain.tld should redirect to www.domain.tld(assuming wordpress is installed on the www.domain.tld) and on particular unique links like domian.tld/yunohost/sso and domain.tld/webapp could be redirected to the Yunohost login and the apps. It would also helpful if the www.domain.tld/yunohost/sso could redirect to domian.tld/yunohost/sso. Thats a lot of configuration to do ,but it would be helpful if someone can give an example of the workaround. Thanks in advance :)

maniackcrudelis commented 7 years ago

Hi,

I'm not sure that I really get it your idea.

I guess you want to have your wordpress by default for your visitors? So, yes , you can't use your main domain directly, or you lose your ability to add another apps on this domain. And usually, www is linked to the domain above.

So, the better way, I think, it's to using the yunohost option "Redirect domain root to this application." which redirect your domain root to an app, like wordpress, without any limitation with the domain.

anmol26s commented 7 years ago

I made the redirect the root domain to the wordpress app , it works well. But the problem is if someone enter wrong link in the root domain it takes them to the yunohost login page. www.domain.tld --> wordpress app installed domain.tld --> root domain when www.domain.tld/xyz take it to page not found in wordpess but domain.tld/xyz takes it to yunohost login page. Is there a way that only a unique link, takes me to yunohost login? For eg. domain.tld/my_secret_link_to_yunohost_login will direct to yunohost login and all other links domain.tld/anylink takes it to www.domain.tld/anylink which will we wordpress app.

maniackcrudelis commented 7 years ago

I think it's possible, but, I can't find where into the nginx config this setting hides itself.

anmol26s commented 7 years ago

Can't it be possible with 'if' statement in the main domian?

maniackcrudelis commented 7 years ago

I don't know, because I don't know where we can find this redirection.

anmol26s commented 7 years ago

I have adapted the solution in this thread https://forum.yunohost.org/t/solved-how-to-change-the-default-page-before-signing-in/56 and it works , only I have concern about the ?someb64chars which is not showing after the https://mydomain.tld/yunohost/sso/ as mentioned in the thread.