Change the Document Root
The document root determines the directory from which your website files are loaded. When a domain is accessed, the web server serves the content from the assigned document root.
These instructions apply to the following hosting products:
Using the Document Root
The document root can be used, for example, to:
- deploy a new website,
- use a test environment on a subdomain,
- switch between different website directories, or
- switch a migrated website to a new directory.
When you change the document root, the domain will then use the files from the newly selected directory. Before making the change, make sure that all required files are located in the new directory.
Requirement
The domain must point to the hosting via an A record for the Web & Mail Control Panel settings to take effect.
You can find more information about the default DNS records in the following article:
https://www.green.ch/en/default-green-dns-records-web-mail-hosting
View the Current Document Root
- Log in to the customer portal at my.green.ch using your MY user and password.
- Open the Web & Mail Control Panel.
- Select Domains in the navigation on the left.
Select Actions for the desired domain.
Next to the domain, you will see the directory / document root.
Change the Document Root
- Log in to the customer portal at my.green.ch using your MY user and password.
- Open the Web & Mail Control Panel.
- Select Domains in the navigation on the left.
- Select Actions for the desired domain.
- Click Edit domain.
- Scroll to the Document root field.
- Enter the desired folder.
- Save the setting by clicking Save changes.
The specified folder determines which files are displayed when the domain is accessed.
Check the Directory Structure
If necessary, use FTP or WEB-FTP to check whether the desired directory exists and contains the required files.
You can find more information in the following articles:
https://www.green.ch/en/ftp-access
https://www.green.ch/en/web-ftp
Additional Domain Settings
In the Edit domain section, additional settings are available alongside the document root.
Preferred Domain
Specify which version of the domain should be preferred:
- www.beispiel-domain.ch
- beispiel-domain.ch
- none
Whenever possible, use a fixed version with or without «www» instead of the «none» setting.
Redirect HTTP to HTTPS
If an SSL certificate is active and correctly configured, you can enable the Redirect HTTP to HTTPS setting. Requests via HTTP will then be automatically redirected to HTTPS.
If this setting is not displayed, the SSL certificate may not yet be activated or may not be configured correctly.
You can find more information in the following articles:
https://www.green.ch/en/activate-http-to-https-forwarding
https://www.green.ch/en/activating-the-ssl-certificate
Redirect to Another URL
This setting allows you to redirect requests to another domain or website. The content from the document root of the original domain will not be displayed.
You can find more information in the following article:
https://www.green.ch/en/domain-forwarding-set-up-domain-connected-to-hosting-package
Display Parked Notice
This setting allows you to park the domain. When the domain is accessed, a standard page is displayed indicating that the domain is currently not actively being used.
The document root and the files stored in it remain unchanged. This change does not affect the email service.
If you want to display web content again after parking the domain, a new SSL certificate must be installed.
https://www.green.ch/en/park-website
Recommended Solution for HTTPS Redirects
- Assign the domain to a web hosting package.
- Activate an SSL certificate for the domain.
- Set up the redirect using a .htaccess file.
This ensures that both HTTP and HTTPS requests work reliably.
Example of a .htaccess Redirect
RewriteEngine On
Redirect 301 / ihrezieldomain.ch
- Create a text file with this content.
- Save the file with the name .htaccess.
- Upload the file to the root directory (Document Root) of the domain.
Useful Tools
https://htaccess.madewithlove.be/
https://www.o-pr.de/weiterleitungen-htaccess/
https://www.df.eu/blog/301-redirects-weiterleitungen-mit-htaccess/
https://www.kreativmedia.ch/de/weiterleitungen-.htaccess
Note on Subdomains
If subdomains such as www.ihredomain.ch should also be redirected, we recommend:
- a corresponding DNS record, for example a CNAME record,
- including the subdomain in the SSL certificate.
This allows both the main domain and the associated subdomains to be correctly redirected via HTTPS.