Results 1 to 4 of 4

Thread: How to use Wild Card Domain

  1. #1
    Join Date
    May 2009
    Posts
    26

    How to use Wild Card Domain

    I need a subdomain resolution to a wildcard setting for a project. By this when a visitor put any subdomain he will be directed to the main domain. Every vistior who try to get an subdomain will get my main domain on his browser. I need to know the steps to enable and to setup a wildcard subdomain on a cpanel server. How to configure it and setup an new wildcard domain.

  2. #2
    Join Date
    May 2008
    Posts
    2,134

    Re: How to use Wild Card Domain

    It is not quiet easy to setup a wild card domain. To setup a wild card domain on your Cpanel server you will need to do this. Do the following steps :
    • Step 1

    First thing you must have a access to the Edit DNS Zone on your server. Whether it si WHM or Cpanel. You will get this option under DNS functions. Click on Edit DNS Zone. Select the domain of your choice to use. Do not edit any of the server in the list. Just the only you need to. Go down and look for Add New Entries Below this Line. Put * in the first box, followed by your server IP address in the place of 65.66.67.68.

    • Step 2

    The second part is to connect to your sever through SSH. You can use a simple tool call Putty to access it. If you have any other tool you can use that also. The idea is that you must have a program that is capable of accessing a server through SSH. Now launch the Putty tool. In the Putty configuration window enter your server's IP address. The port should be 22, unless you've configured your SSH access to another port. Click on Open. Now type the following text into Putty window :
    * login as: username
    * password: password
    * enter: cd /etc/httpd/conf/
    * enter: pico httpd.conf
    * press: ctrl w
    * enter: youdomain.com
    Now edit the line : ServerAlias yourdomain.com to: ServerAlias: *.yourdomain.com yourdomain.com. Now click ctrl x to exit. Save your work. Now you are done with configureing your server to use a wildcard dns for your subdomain.
    At last you to get your wildcard subdomain name with PHP
    PHP Code:
    $serverhost explode('.',$_SERVER["HTTP_HOST"]);
    $sub $serverhost[0];
    if (
    $sub "www") {
    $sub "";

    Insert the above php code in your main php file. By the above code use appropriate setting for your sub domains.

  3. #3
    Join Date
    Apr 2008
    Posts
    2,277

    Re: How to use Wild Card Domain

    To setup you Wildcard Subdomain do this :
    1. Login in your CPanel
    2. Search for DNS Zone > Edit DNS Zone
    3. Select a Domain > Add New Entries Below this Line.
    4. Now you will need to put a * in the first box and choose A from the list.
    5. Add your server IP address in the next field.
    6. Go to Cpanel and select Subdomains menu use * in place of the subdomain prefix/name. Select to Add Subdomain.


    Configure your subdomains.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,276

    Re: How to use Wild Card Domain

    I am giving you a very simple steps to setup your own wildcard domain. Just after configuring the below setting you will be able to use your own wildcard domain.
    Go to DNS control > A Record > Enter your IP Domian Address.
    Then Select Admin Level > Custom Httpd configurations > domain.com
    In the top text area, add this *one* line: ServerAlias *.|DOMAIN| then click “Save”.
    Then wait for a while.
    The wildcard subdomains will point to your main public_html directory for the domain.

Similar Threads

  1. Replies: 6
    Last Post: 08-03-2012, 01:14 AM
  2. OfficeScan 10.5 Update Patch for Wild Card usage
    By -Deven- in forum Networking & Security
    Replies: 8
    Last Post: 25-08-2011, 10:18 PM
  3. Can I Download Ringtones to my Virgin Mobile Wild Card
    By Custidio in forum Portable Devices
    Replies: 3
    Last Post: 18-08-2009, 06:44 PM
  4. /xf does not accept path with wild card
    By skipro in forum Windows Software
    Replies: 1
    Last Post: 13-10-2008, 01:38 PM
  5. Replies: 4
    Last Post: 31-08-2008, 07:10 PM

Tags for this Thread

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
  •  
Page generated in 1,713,920,383.55903 seconds with 17 queries