Jump to content

Sub Domain Catch-all


mvpzone
 Share

Recommended Posts

Folks

I wanted to know if any of you have experiences in setting up a catch all sub-domain. To give an example:

1. I have a domain ****

2. I want all requests to *.**** to land at www.****

 

I thought i could handle this via a rewrite rule (simplified)

 

#To redirect any subdomain to www

RewriteEngine on

RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]

RewriteCond %{HTTP_HOST} !^$

RewriteRule ^/(.*) *****/$1 [L,R=permanent]

 

Added this to my .htaccess at my docroot and does not seem to work. Any pointers...

 

Cheers

Link to comment
Share on other sites

Looks like i am not in luck. In my Cpanel i see that i have an option to redirect at resource level

 

http://****/foo.html ----> http://****/bar.html

 

I do not see a possibility to set it up at sub-domain level.

 

i do not want to create any sub-domain just want to catch requests to any sub-domain and route them to www.****

 

I tried creating a sub-domain with name * and it failed with an exception that stated could not resolve this to an IP

Link to comment
Share on other sites

Thanks for the addtional tip Rick. I do not have any plans to create an additional sub-domain yet. Nevertheless i will keep this in mind when i intend to create one.

 

Does this mean when i have to create a dedicated sub-domain, i will not have a working catch-all or is it that the manual intervention on the server will have to be redone (to function for the non-existent sub-domains).

 

Cheers.

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.

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.

 Share

×
×
  • Create New...