Creating a virtual submdomain and redirection?


webtester01
 Share

Recommended Posts

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.

Link to comment
Share on other sites

Didn't work.

I went to cpanel > Subdomains.

Let's say my main domain is maindomain.com

I see that there's

domaina.maindomain.com

So, for the subdomain input text, I put * and the document root is public_html/

domaina.com will contain the .htaccess of my script.

I tested http://testing.domaina.com 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.

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...
 Share