DNS Settings

They have: 8 posts

Joined: Mar 2005

How do you set up the server so all subdomains dns settings send you to your main domain? So, if I typed in anything.domain.com, it would send me to domain.com

They have: 15 posts

Joined: Mar 2005

Do you have your own dns server? Or are you using a webhosting console?

Thanks

Leah

They have: 8 posts

Joined: Mar 2005

I'm using a host. Basically I want the user to be able to type whatever they want as the subdomain, have the subdomain'd name assigned to a variable, and be able to have the user see a text that uses that variable in a sentence like "Hello, $subdomain, welcome to the site!"

openmind's picture

He has: 945 posts

Joined: Aug 2001

You need to set the site up on its own dedicated IP. Then add a A record with a * pointing to that IP. Finally use a bit of server side script to grab the subdomain. Not sure how you would do it in PHP but with ColdFusion you would simply do:

<cfset tAccountToProcess = ListFirst(CGI.SSERVER_NAME, ".")>
<cvoutput>Hello, #tAccountToProcess#, welcome to the site!</cfpoutput>
'

They have: 8 posts

Joined: Mar 2005

Quote: You need to set the site up on its own dedicated IP. Then add a A record with a * pointing to that IP.

I'm not exactly sure what you mean or how to do that. I'm a newbie at server stuff.

openmind's picture

He has: 945 posts

Joined: Aug 2001

OK it really depends if you have access to a conmtrol panel for the domain. If you can't do the above through the panel, simply ask your host to do it for you...

It won't cost them anything and should take less than 5 minutes...

They have: 8 posts

Joined: Mar 2005

I do have access to the control panel.

openmind's picture

He has: 945 posts

Joined: Aug 2001

OK so whats the control paenl? cPanel, Ensim, HELM?

They have: 8 posts

Joined: Mar 2005

cPanel

openmind's picture

He has: 945 posts

Joined: Aug 2001

http://www.cpanel.net/docs/cp/index.html

Have a look at the docs above and if your host has enabled he feature, you will be able to assign a dedicxated IP and change the dns records.

They have: 8 posts

Joined: Mar 2005

I cant seem to find the guide you're talking about.

openmind's picture

He has: 945 posts

Joined: Aug 2001

I would suggest speaking to your host to be honest...

They have: 5 posts

Joined: Apr 2005

You could try a rewrite rule in .htaccess

maybe something like this.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^*.domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.*.domain.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

of course change domain.com to your domain.

Good luck.

Wink

Now offering cPanel hosting packagesJC-Hosting

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.