How to enable sub domain hosting in wordpress blog?

by blog-master on October 9, 2011 · 0 comments

in Wordpress




Here we will teach you how to enable sub-domains in wordpress blog?

It is called as Wildcard. Wildcard subdomains are useful when you wish to redirect all visitors to your main website regardless of what subdomain they access your website through.

This is also useful when someone mistypes www for example and writes ww.yourdomain.com.

In other words, with wildcard subdomains it won’t matter whether someone accesses your site through ww.yourdomain.com or wwwwww.yourdomain.com.

Here are three ways to enable wildcard subdomains for your website:

1) The easiest way to enable wildcard subdomains is to create a subdomain *.yourdomain.com. Cpanel customers can do this from their cPanel > Subdomains.

You should make sure that the subdomain’s Document Root is public_html.

2) If you are using cPanel and you have access to WHM, you can log in to WHM and go to Edit DNS Zone. Select the domain you wish to modify from the list of available websites.

Under Add New Entries Below this Line you should fill in the fields so that they look like:

* 14400 IN A 11.22.33.44

where 11.22.33.43 is the IP of the account

3) Another way to enable wildcard subdomains is to directly edit the httpd.conf file. (For this you will need root access to the server hosting the account.)

Log in as root and open the httpd.conf file (usually this file is located in /etc/httpd/conf) with a text editor such as vim or nano. Then find the VirtualHost entry for the website. It should look like:
ServerAlias www.yourdomain.com
ServerAdmin admin@yourdomain.com
DocumentRoot /home/yourdoma/public_html/joe
ServerName yourdomain.com
User yourdoma
Group yourdoma
BytesLog /usr/local/apache/domlogs/yourdomain.com-bytes_log
CustomLog /usr/local/apache/domlogs/yourdomain.com combined
ScriptAlias /cgi-bin/ /home/yourdoma/public_html/joe/cgi-bin/

The only modification you need to make is change:

ServerAlias www.yourdomain.com

to

ServerAlias *.yourdomain.com

After these steps, you need to make some changes in wordpress.

 

Allow Multisite

To enable the Network menu item, you must first define multisite in the wp-config.php file.

Open up wp-config.php and add this line above where it says /* That's all, stop editing! Happy blogging. */:

define('WP_ALLOW_MULTISITE', true);

Step 4: Installing a Network

This will enable the Network menu item to appear in the Tools menu. Visit Administration > Tools > Network Setup to see the screen where you will configure certain aspects of our network.

Addresses of Sites in your Network
You are given the choice between sub-domains or sub-directories (if none of the above applies). This means each additional site in your network will be created as a new virtual subdomain or subdirectory. you have to pick one or the other, and you cannot change this unless you reconfigure your install. See also Before You Begin.

  • Sub-domains — like site1.example.com and site2.example.com
  • Sub-directories — like example.com/site1 and example.com/site2
Network Details
There are filled in automatically.
Server Address
The Internet address of your network will be example.com.
Network Title
What would you like to call your network?
Admin E-mail Address
Your email address.

Double-check they are correct and click the Install button.

You may receive a warning about wildcard subdomains. Check Setting Wildcard Subdomains.

Warning! Wildcard DNS may not be configured correctly!

The installer attempted to contact a random hostname (13cc09.example.com) on your domain.

To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a * hostname record pointing at your web server in your DNS configuration tool.

You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.

 

Enabling the Network

The rest of the steps are ones you must complete in order to finish.

Tools Network Created

 

0. First, back up your existing wp-config.php and .htaccess files.
1. Create a blogs.dir directory under /wp-content/
This directory is used to stored uploaded media for your additional sites and must be writable by the web server. They should be CHOWNed and CHMODed the same as your wp-content directory.
2. Add the extra lines your WordPress installation generates into your wp-config.php file.
These lines are dynamically generated for you based on your configuration.
Edit the wp-config.php file while you are logged in to your sites admin panel.
Then just paste the generated lines immediately above /* That's all, stop editing! Happy blogging. */.

 

3. Add the generated mod_rewrite rules to your .htaccess file, replacing other WordPress rules.
(If there isn’t one, then create it.)
These lines are dynamically generated for you based on your configuration.
4. Log in again.
Once the above steps are completed and the new wp-config.php & .htaccess files are saved, your network is enabled and configured. You will have to log in again. click “Log In” to refresh your Adminstration Panel. If you have problems logging back in, please clear your browser’s cache and cookies.



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. How to move wordpress site to a new host or new domain?
  2. What is wordpress ? Learn the difference between WordPress.org and WordPress.com
  3. How to create wordpress.com & wordpress.org sites ?
  4. step by step OSPF configuration
  5. How to delete all pending comments on wordpress ?

Leave a Comment

Previous post:

Next post: