Thursday, March 12, 2015

How to Set Up Virtual Hosts For Magento at localhost

 Web developer often need to work into vitual host using live domain for  some reason.


Que : If you want to  run the license extensions into localhost, extension will not work.

Solution: Create VirtualHost with same license domain name & perform your work as best.

How you will do it ? follow the following few steps.

Step 1

Go to "C:/Windows/System32/drivers/etc" and open the "hosts" file in Notepad++ or notepad.

File will seem like below.


# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#    127.0.0.1       localhost
#    ::1  

Add following line at the end file.


127.0.0.1   www.xyz.com   #your site name


Step 2

Open httpd.conf file from "D:\xampp\apache\conf\httpd.conf"
or you can open it directly from XAMPP control panel

Search following line

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf


Remove # (comment ) from #Include conf/extra/httpd-vhosts.conf


Step 3

Go to "C:\xampp\apache\conf\extra\httpd-vhosts.conf"

Add following code at the end of file.


<Directory C:/xampp/htdocs>
Order Deny,Allow  
Allow from all
</Directory>

After the directory code you just added, add following code too:

<VirtualHost *:80>  
DocumentRoot "C:/xampp/htdocs/magento19"
ServerName www.xyz.com
</VirtualHost>


Save all and Restart the Apache.

Step4

Open your browser and enter  "www.xyz.com" into address bar, or whatever your domain name is.


working ? Yes!!!  Enjoy!!!

:( not working ? comment your query here....















No comments:

Post a Comment