0

I have a wordpress blog site that runs a sort of farm style instance. Each user has a url that is appended after the master subdomain(Example blog.CoolCompany.com/user)

I have to create a DNS record and vhost entry that links a new subdomain to a user's wordpress blog.

For example: marketing.CoolCompany.com must direct to blog.CoolCompany.com/user999

I have created a CNAME record that points marketing.CoolCompany.com to blog.CoolCompany.com. However I am stuck on creating a redirect of anything coming in from marketing.CoolCompany.com to the url path of /user999

Since this is a wordpress blog the pages are stored in the database so I can't just point to a local folder path. Is there a way to create a Vhost file or something similar that would direct the traffic from marketing.CoolCompany.com to blog.CoolCompany.com/user999?

1
  • 1
    Please read the wordpress tag you included. You are asking an off-topic question. See On Topic. Questions about wordpress.com belong on Web Applications. Questions about installing and maintaining WordPress belong on WordPress Development
    – DavidPostill
    Commented Feb 24, 2017 at 15:15

1 Answer 1

0

For anyone who experiences something similar in the future a vhost file that looks like the following should work:

<VirtualHost *:80>

ServerName      marketing.coolcompany.com

RedirectMatch permanent ^/(.*$) http://blog.coolcompany.com/user999

ServerAlias marketing.coolcompany.com
</VirtualHost>

Not the answer you're looking for? Browse other questions tagged .