

A few things that haven’t come up yet, since a lot depends on whether you want it to be just for you or something that can get real HTTPS.
- For dev machines, use
.testor.localhost. Both are reserved by RFC 6761, so they can never be registered by someone else and will never collide with a real site..localhostalso resolves to loopback by itself in most browsers, somyapp.localhostneeds no hosts-file entry. - Avoid
.local. As mentioned above, it’s reserved for multicast DNS (RFC 6762), so on a lot of systems the lookup goes to mDNS instead of your DNS server and you get random slow or failing resolution..lanand.homeare popular but not reserved by any RFC, so a clash with real DNS is possible in principle. - For a home network, the standard answer is
home.arpa(RFC 8375). It’s reserved specifically for this, sonas.home.arpais safe. - If you want valid certificates on LAN hosts (phones and some apps refuse custom root CAs), buy a cheap domain and use subdomains of it for internal hosts. You don’t have to expose anything: use a DNS-01 challenge with Let’s Encrypt, which proves ownership through a TXT record instead of an inbound HTTP request, and it also supports wildcard certs. Point the names at private IPs via your local DNS.
- For purely local HTTPS on a dev machine,
mkcertcreates a local CA and certs for.test/.localhostnames, trusted by your own browser, with no public domain required.
So: .localhost/.test plus mkcert on the dev box, and an owned domain with DNS-01 for anything you want proper certs on.
Since you can’t use vhosts or subdirectories on that host, .htaccess can do it with mod_rewrite. Something like this in the .htaccess in your main folder (adjust the domain and filename):
How it works: each RewriteCond applies only to the RewriteRule right below it, and it checks the Host header, so example.net is never touched. The first rule serves project.html (internally, the URL in the browser stays project.test/) when someone visits the root. The second returns a 404 for every other path on that domain. The
!^project\.html$exception matters: Apache re-runs the rules after the internal rewrite, and without it the second rule would 404 your own page.Two things to watch. If project.html uses CSS, JS or images, those requests also hit project.test and will 404, so either inline them or add them to the exception, e.g.
!^(project\.html|style\.css)$. And in .htaccess the pattern has no leading slash (^$, not^/$).On regex: you don’t need to learn it first. Here you only need
^(start),$(end),\.(a literal dot) and!(not). Learn the rest as you go. For learning, the mod_rewrite intro and the RewriteCond/RewriteRule reference in the Apache docs are decent, and regex101.com lets you test patterns live. If something doesn’t work, check the host’s error log, and note that some shared hosts cache .htaccess changes for a minute or so.