As I can run multiple sites on this webspace, I installed a second WordPress site in a subdirectory: example.com/wp2
.
The ability to "run multiple sites on this webspace" is most probably referring to the ability to have multiple domain names pointing to your webspace, rather than having multiple instances of a CMS installed (which you could do anyway, regardless of whether "multiple sites" are permitted or not).
The multiple domains are achieved by creating an "Addon Domain" or "Domain Alias" at BlueHost.com (cPanel terminology, but the idea is the same regardless of the hosting control panel used).
An "Addon Domain" and "Domain Alias" are very similar. A "Domain Alias" is essentially just that, an alias for your main domain and usually points at the main domains document root. An "Addon Domain" on the other hand has its own document root and can point directly to a subdirectory (for example).
You should probably be created example.net
as an "Addon Domain" on your BlueHost.com hosting account that points directly to the /wp2
subdirectory.
I furthermore own a second domain - let's call it example.net
- which is rented from nearlyfreespeech.com. I therefore created a .htaccess
file which forwards all traffic from example.net
to example.com/wp2
.
Simply 3xx "redirecting" the request from example.net
to example.com/wp2
is naturally going to expose example.com
. Alternatively, you could create a reverse proxy at your nearlyfreespeech.com (NFS.com) hosting and proxy the requests to example.com/wp2
- but this is a lot more work, requires a hosting account at NSF.com with server-level access.
Instead, you should forget the hosting/.htaccess
at NFS.com and point the example.net
directly at your example.com
account (having created the "Addon Domain" as mentioned above), by either:
- Create DNS
A
records for example.net
(and www.example.net
?) that point to the IP address of your example.com
server.
- Change the NAMESERVERS on
example.net
to point to BlueHost.com and control the DNS at BlueHost.com instead. BlueHost.com will have already created the necessary A
(and CNAME
) records at the time you created the "Addon Domain".
If you want you can also transfer the domain to BlueHost.com (and change NAMESERVERS in the process) if you wanted to finish with NFS.com completely. This is entirely up to you. You don't need to change registrar in order to use the domain at BlueHost.com.
No additional .htaccess
files or directives are required in this scenario.
Many tutorials point out that a .htaccess
file should be placed in the root directory of example.com
to rewrite the URL.
Those tutorials would seem to be referring to something else?
second.com
atnearlyfreespeech.com
? – MrWhite Nov 3 '18 at 21:49