1

Old hand with WordPress and a lot of multi-site experience here. But I am chewing on best way to route a subdomain of a TLD already domain mapped on the MS installation.

EXAMPLE: TLD is A-Recorded to the WP multi-site via IP and correctly resolves. Say it is MAPASITE.com and that is correctly finding the right blog. Now if I want to next map a subdomain of that TLD -- say subdomain.MAPASITE.com -- to a page on the blog, what is the best way to do so?

I thought about .htaccess and 301 redirects but am not sure if there might be a simpler c-Record or forwarding method direct from the Registrar? Thanks for the help.

1 Answer 1

0

I don't know if it works for wordpress pages aswell but you can make virtualhosts in your apache installation and set a different document root for a subdomain. I use this, but I don't use wordpress.

In case this might solve it: to change the documentroot (where the user lands when visiting a domain) just make a new .conf file in the directory where your apache installation stores its configs. These lines should do it:

<VirtualHost *:80>
DocumentRoot /var/www
Options -Indexes
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /var/www/somemap
ServerName subdomain.example.com
ErrorLog /var/log/apache2/someerrorlog
CustomLog /var/log/apache2/someaccesslog combined
Options -Indexes
</VirtualHost>

You can skip the ErrorLog and CustomLog parts if you don't want a separate errorlog and accesslog for the subdomain. The first <virtualhost> is to set the default documentroot, just point it to whatever it now is. Since you use a MS installation it certainly is different since mine is from a Debian install.

I hope this gives a solution to your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.