Creating a virtual submdomain and redirection?


Recommended Posts

Let's say I have two domains. and

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, would redirect to

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

I tested but it gives me an error (page not found).

RewriteCond {HTTP_HOST} !^$

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

RewriteRule ^.*$

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

Link to comment
Share on other sites

Didn't work.

I went to cpanel > Subdomains.

Let's say my main domain is

I see that there's

So, for the subdomain input text, I put * and the document root is public_html/ will contain the .htaccess of my script.

I tested but got a page not found error.

Link to comment
Share on other sites

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.

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.