Redirecting the Web Site to Your Computer
1) Locate your hosts file. In Windows XP, this file is located in C:\WINDOWS\system32\drivers\etc
2) Open the file with a plain text editor (like Notepad++). Using a word processor, like Word, can mess up the file when you save it
3) Add lines containing the domain name(s) and IP address to redirect to.
127.0.0.1 domain_name_1 127.0.0.1 domain_name_2
4) Save the changes.
5) Restart your browser (if it was open when you made the change to your hosts file).
Getting Apache to Serve Your Web Site
6) Locate the httpd-vhosts.conf file. For most XAMPP 1.7.3 installs this will be C:\xampp\apache\conf\extra (in my case, I installed XAMPP on my D-drive, so the folder is D:\xampp\apache\conf\extra)7) Open the file using a plain text editor (like Notepad++). Using a Word processor, like Word, can mess up the file when you save
8) Add, at the bottom of the file, new virtual hosts for each domain you added in step 3) above. Each host will have the following form:
// ServerName www.joomla.16 ServerAlias joomla.16 DocumentRoot d:/xampp/htdocs/joomla16 //
ServerName: following this label, add the name of the domain you added in step 3)
ServerAlias: following this label, you may add as many alternate domains (separated by spaces) as you like that are supposed to resolve to this virtual host. Remember that www.my-domain.com is different from my-domain.com, but, typically, you would want them to resolve to the same server.
DocumentRoot: following this label, add the path where your website is located. You can use an absolute path (as in the example above), or a relative path (but relative paths can be trickier to set up, so I prefer to use an absolute path).
9) Save the file.
10) Restart the Apache Server to have the change take effect. Do this by clicking on the Stop button on the XAMPP control panel and then clicking on the Start button. (You could also just reboot the computer, but that is overkill).
Note: Remember enable module vhosts in httpd.conf file (ex: D:\AppServ\Apache2.2\conf\httpd.conf )
(http://www.complete-concrete-concise.com/web-tools/how-to-change-localhost-to-a-domain-name)
Không có nhận xét nào:
Đăng nhận xét