Is there any way to make all requests to any subdomain load the same WordPress website e.g. user1.example.com, user2.example.com and user3.example.com all load the same website, but with the links pointing to the current subdomain?
I’d like to keep mostly the same content across the different websites. The only difference is that by reading the subdomain I can offer customized content (website title, etc) specifically to that user, or add a hook to display an error message if the user doesn’t exist. At the moment the network install requires me to manually define every website, with different contents across them.
In WordPress you can easily do this with sub-directories like example.com/user1
Sub-domain & URL Strategy
Having username.domain.com
will prevent you in the future from having your own sub-domains like shop.example.com
and will plague you if you wanted to use www.example.com
or just http://example.com
Finally … what if some user wants to use expletives or special characters in their username <– not very good.
Traffic Load
Sub-domains are analysed (sic) by DNS servers around the world to figure out how to route traffic. If you want to use many sub-domains, this will also increase the load on your Apache web server as it tries to figure out what to do with someusername123456789.example.com
But to do this … you’d need to look at scripts, htaccess and rewrite rules and then, this question is probably better suited for a different forum.
Sub-directories are easy along with URL parameters
Its safe to say that sub-direcotries are easy (WordPress Author pages as example) and then WordPress can analyse this and determine what to do.
You can even use URL parameters like www.example.com/category/?user=username123456789
In summary — don’t do subdomains for usernames it can cause multiple headaches that you don’t want.