Redirect domain to another folder


#1

Hi,

Very quick quesiton, how can I redirect a domain/folder created with EE to another folder?

Example:

www.domain.com is in folder /domain.com fr.domain.com is in folder /fr.domain.com

How to redirect fr.domain.com into /domain.com?

Thanks


#2

Hi,

Just an up because I am still not about to do this.

create an domain is easy like www.domain.com but create another blog.domain.com to use the same folder than www.domain.com seems not possible?


#3

Hi thaipop!

**

OPTION A

** (if you used the ee command “ee site create fr.domain.com --somesuffix” and want to keep the possibly created databases, directory structure etc.)
you need to navigate via ssh / sftp tool to the following location on your server:

/etc/nginx/sites-available/

and open / edit this file:

fr.domain.com

find the line that starts like this:

root /var/www/fr.domain.com/htdocs/;

change the path like so:

root /var/www/domain.com/htdocs/;

Save and close file.

Now run either:

ee stack restart --nginx
or
service nginx restart

That’s it! You changed the webroot path and anyone accessing fr.domain.com will now reach domain.com instead.

OPTION B

** (if you used the ee command “ee site create fr.domain.com --somesuffix” and want to get rid of possibly created databases, directory structure

first run
ee site delete fr.domain.com
or
ee site delete blog.domain.com

then follow steps below.

or if you did not use the site create command at all yet)
you need to navigate via ssh / sftp tool to the following location on your server:

/etc/nginx/sites-available/

and open / edit the following file:

domain.com

find the line that reads something like this:

server_name domain.com www.domain.com;

edit that line like so:

server_name domain.com www.domain.com blog.domain.com fr.domain.com;

Save the file and run either

ee stack restart --nginx
or
service nginx restart

Now anyone accessing blog.domain.com or fr.domain.com will be redirected to domain.com content.

Best
Saskia


#4

Hi SaskiaLund

Thank you very much for having taking time to answer this question and to have specified 2 kind of scenarios.

You are correct, I’ve tested and this is working as expected.

Thanks again!


#5