Skip to content

Product docsLinux hosting

Domains, PHP versions and .htaccess on Linux hosting

Run more sites on one HyperDC Linux hosting service: add an add-on domain or subdomain, choose the PHP version of each site and use your .htaccess rules.

  • Beginner
  • 10 min read
  • Updated

This guide is not available in your language yet, so it is shown in English.

On this page
  1. Add an add-on domain or subdomain
  2. Choose the PHP version of a site
  3. Serve a site from a subfolder
  4. Use .htaccess rules
  5. Set a custom error page
  6. Next steps

One Linux hosting service can hold more than one site, within your plan's limits. You add them in the Websites tab of your service page; each gets its own folder and runs the PHP version you choose for it.

Add an add-on domain or subdomain

  1. Open Websites and select Add Domain.
  2. Under Type, choose Add-on Domain, Subdomain or Alias. An alias shows a site you already have under another name.
  3. Enter the Domain name, such as example.org or blog.example.com. For a subdomain or an alias, choose the site it Belongs to.
  4. For an add-on domain or a subdomain, leave Document root empty to have a folder created for you, and choose the PHP version.
  5. Select Add Domain.
  6. Point the new name to the Server IP address shown on Overview; see point a domain to your server.

Verify: the name appears in the list with its document root. Upload a file there with File Manager and open the address.

The list shows each site's Document root, its Runtime, the PHP version it runs, its SSL and its State. To remove a site other than the primary one, select Delete in the three dots of its row; the site and its certificate are removed, and this cannot be undone.

Choose the PHP version of a site

The newest PHP versions are ready, and each one is kept at its latest release for you.

  1. In Websites, select Settings next to the site.
  2. Under PHP settings, choose the PHP version: 8.3, 8.4 or 8.5. No PHP turns it off for this site.
  3. Select Save Settings and confirm with Save And Restart.

Below the version, the same section sets the site's own PHP values, such as upload_max_filesize, post_max_size and max_execution_time. Errors are never shown to visitors: they go to the PHP error log of this website.

Your account runs its own PHP processes under its own system user, so no other customer's site shares them.

Verify: a page on the site that prints phpversion() shows the version you chose. Delete that page afterwards.

Serve a site from a subfolder

Some applications, such as Laravel, serve their pages from a subfolder like public. In Websites, select Settings next to the site and enter the folder in Document root under General, such as httpdocs/public. Then select Save Settings and confirm with Save And Restart.

Verify: the site's home page opens at https://example.com/, without /public in the address.

Use .htaccess rules

.htaccess rules work as on Apache. WordPress pretty permalinks, Laravel-style front controllers and the rewrites of other CMSs work as they come, for example WordPress's own block:

Apache
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

A change to a .htaccess file applies within seconds; there is nothing to restart. The site's Settings list every .htaccess file of the site under Rules from .htaccess files, marked Applied, or with View Lines when a line was left out, so you can see why a rule does not act.

Verify: a pretty link of your site, such as https://example.com/about/, opens the right page.

Set a custom error page

  1. Upload your page, such as /errors/404.html, in File Manager.
  2. Add an ErrorDocument line to the .htaccess file in your document root:
Apache
ErrorDocument 404 /errors/404.html

Verify: an address that does not exist shows your page, and the browser still receives a 404.

Next steps

Frequently asked questions

How many domains can I add?

Your plan sets the number. The Add a domain form shows how many add-on domains, subdomains and aliases your plan allows.

Which PHP versions can I choose?

The newest PHP versions, each kept at its latest release. Each site can use its own version, or none.

What is an alias?

Another name for a site you already have, such as example.net for example.com. It shows the same website and has no folder of its own.

Do I have to rewrite my .htaccess for this server?

No. .htaccess rules work as on Apache, so your rewrites, redirects and error pages work as they are.

Generera Lösenord

Please confirm