By A Web Design
The location of Apache´s httpd.conf file is normally at
C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
NOTE: This is assuming that Apache was installed in C:\Program Files on your local computer.
Open httpd.conf file in any text (i.e. ASCII) editor of your choice. Notepad is excellent.
Locate the code block contained within
<Directory "C:/Program File/Apache Software Foundation/Apache2.2/htdocs"> </Directory> entities as shown in Diagram 1.

Diagram 1
Select this code block. Copy and Paste this code block immediately below the original.
NOTE: Please ensure that both
<Directory . . . .> and the </Directory>tags exist.
Change <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" > </Directory>.
To
<Directory "D:/public_html/moodle"> as shown in Diagram 2
NOTE: Ensure the use of the forward slash as shown above.

Diagram 2
These entries within Apache´s httpd.conf file ensure that Apache knows that D:\public_html\moodle exists and that directory permissions are set.
Once Apache knows the existence and location of D:\public_html\moodle appropriate entries in the httpd-vhost.conf must be made.
httpd-vhost.conf is normally located at
C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra\httpd-vhosts.conf
Open the httpd-vhost.conf file in any text (i.e. ASCII) editor of your choice. Notepad is excellent.
Copy the <VistualHost *.80 > </VirtualHost> block of code and paste it immediately below the original code block.

Diagram 3
Make the following changes as shown in Diagram 4
ServerAdmin: <Email Id>
DocumentRoot: <Path where your virtual domain is located>
ServerName: <Name of the website>
ErrorLog: <Folder where all Apache errors logs will be stored>
NOTE: The folder named in the ErrorLog entry must be created in the d:\public_html\moodle as it does not exist. It must contain a zero byte file named errorlog.txt within it.
CustomLog: Comment out the CustomLog directive using a # as shown in diagram 4.

Diagram 4
After making all the above entries in both httpd.conf and httpd-vhost.conf
Please Restart Apache Web Server
NOTE: The Apache Web Server icon is normally visible in the status bar of the Window.
Look at the extreme right hand side of the status bar.
If Apache Web Server does not restart please check all the entries made in the httpd.conf and httpd-vhost.conf files.
NOTE: Look especially carefully for spelling mistakes.
Now it’s time to make entries in Windows HOSTS file as shown in Diagram 5
The HOSTS file contains mappings of IP addresses to host names.
There can only be a single IP address / host name pair on a single line in the HOSTS file.
NOTE: The IP address and the Host name must be separated by a TAB.
The HOSTS file is normally located at C:\WINDOWS\system32\drivers\etc\hosts

Diagram 5