Recommended Posts

Posted

Let's say I have two domains.

http://domainA.com and http://domainB.com

domainA is merely use as a 301 redirect to domainB. So, I want to use domainA to create virtual subdomains -- is this possible?

For example, http://testing.domaina.com would redirect to http://domainb.com/blog/testing

I used the code below (as a hypothetical example), but it didn't work.

I tested http://testing.domaina.com but it gives me an error (page not found).


RewriteCond {HTTP_HOST} !^domaina.com$

RewriteCond {HTTP_HOST} ^([a-zA-Z]+).domainb.com$

RewriteRule ^.*$ http://domainb.com/blog/%1

The other way is to manually create a subdomain on domaina.com each time by logging into Cpanel, but I don't want to do that each time for hundreds of subdomains.

Posted

Did you make sure to setup a wildcard subdomain in cPanel? You need to do this so putting * instead of subdomain. Then you set it to a document root folder then you can actually work with mod_rewrite to send it to specific internal url's.

Posted

Did you allow for DNS propagation? Or was it simply a page not found displayed by the server? It might be best though if you make a support ticket someone might be able to assist you. Tough to offer advice when don't know your actual account.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...