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
On this page
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
- Open Websites and select Add Domain.
- Under Type, choose Add-on Domain, Subdomain or Alias. An alias shows a site you already have under another name.
- Enter the Domain name, such as
example.orgorblog.example.com. For a subdomain or an alias, choose the site it Belongs to. - For an add-on domain or a subdomain, leave Document root empty to have a folder created for you, and choose the PHP version.
- Select Add Domain.
- 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.
- In Websites, select Settings next to the site.
- Under PHP settings, choose the PHP version: 8.3, 8.4 or 8.5. No PHP turns it off for this site.
- 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:
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
- Upload your page, such as
/errors/404.html, in File Manager. - Add an
ErrorDocumentline to the.htaccessfile in your document root:
ErrorDocument 404 /errors/404.htmlVerify: an address that does not exist shows your page, and the browser still receives a 404.
Next steps
- Secure every new name: free SSL on Linux hosting.
- A database for your application: databases on Linux hosting.
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.