Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 3 of 3

This is a discussion on Help with Dynamic Subdomain in the VPS & Dedicated forum
Hello, I have a VPS host here and for this example my domain is www.test.com What I’m trying to do is create a dynamic sub ...

  1. #1
    JPC Member
    Join Date
    Feb 2008
    Posts
    6

    Help with Dynamic Subdomain

    Hello,

    I have a VPS host here and for this example my domain is www.test.com

    What I’m trying to do is create a dynamic sub domain so whatever I type before it, passes through a htaccess file and will let me handle it however I want. So, if someone typed sdhsfoisd.test.com it would say ok, let’s take you to the main website directory, oh look there’s a htaccess file what should we do now, the htaccess would redirect that url to any place I want it to go.

    I tried creating a DNS A record pointing to my IP (*.test.com xxx.xxx.x.xxx) but we have over 50 sites on the same IP so it just kept redirecting to http://xxx.xxx.x.xxx which didn’t have a site there.
    I also tried adding the following to the httpd.include file in the vhosts' conf directory but it didn’t help either.
    Code:
    <VirtualHost *:80>
    	ServerName   *.test.com:80
    	ServerAlias  www.test.com
    	UseCanonicalName Off
    	SuexecUserGroup         carl psacln
    </VirtualHost>
    The whole goal for this is to make a subdomain that accepts anything you type. It sends it to the root directory of the site where the htaccess will then handle the request.

    Any ideas on how to do this?

  2. #2
    the Windlord Gwaihir's Avatar
    Join Date
    Jun 2002
    Posts
    2,562
    It's called a "wildcard subdomain". When I put that in Google, the top link was this tutorial: http://steinsoft.net/index.php?site=...wildcarddomain Looks complete to me .

    N.B. If you access any production sites in this way, you should make sure you redirect (code 301) each possible access URL to one preferred URL. If you don't, the search engines will see your site as a series of duplicates of itself and spread the rating accordingly..
    Regards,

    Wim Heemskerk
    ---
    Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
    And Gwaihir.net - The Middle-earth CCG store

  3. #3
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Wildcard domains work best when they are set to an IP address set to just that domain. Apache works with domain names as a whole--abc.domain.com, def.domain.com, and xyz.domain.com will all be seen as completely different domains to Apache, so if they aren't specifically mapped to a site (VirtualHost) then Apache will load to whatever site is set as the default for the IP, exactly what that is will depend on your server setup. For cPanel sites (the only setup I've done this with), the default for the IP will be the user account when it has a dedicated IP and the server root when it doesn't.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •