Your web server (whether Apache or IIS or something else), serves up web pages from a specified directory. For example, your site might be located in /htdocs/mysite/…. The virtual hosts setup is needed to redirect the URL to the sub-directory hosting your site. In other words, if you typed in localhost (or 127.0.0.1) into your browser’s URL field, you would go to your website instead of the XAMPP local host homepage (assuming you are running XAMPP). I would guess that Joomla! or whatever site you are running on your local host is located in the root of the htdocs directory. (You could also just reboot the computer, but that is overkill). Do this by clicking on the Stop button on the XAMPP control panel and then clicking on the Start button. 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).ġ0) Restart the Apache Server to have the change take effect. Remember that is different from, but, typically, you would want them to resolve to the same server.ĭocumentRoot: following this label, add the path where your website is located. 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. ServerName: following this label, add the name of the domain you added in step 3) The file will contain some documentation and sample virtual hosts.Ĩ) Add, at the bottom of the file, new virtual hosts for each domain you added in step 3) above. Using a Word processor, like Word, can mess up the file when you save: 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):ħ) Open the file using a plain text editor (like Notepad++). Other versions or XAMPP, or different Apache Server installations may have the files in different locations, or may even have the files named differently.Ħ) Locate the nf file. You would do that by entering Bing’s IP address in your host file followed by the web site you want to resolve to that IP address: 195.57.152.178 ĥ) Restart your browser (if it was open when you made the change to your hosts file). For example, suppose you are boycotting Google, so you decide to redirect to instead. You can also redirect (on your computer only) one website to another. NOTE: this redirection only happens on your computer – everyone else in the world will still go to Google’s home page. If you entered the line: 127.0.0.1, then every time you typed into your URL field, your browser would redirect the request to your machine instead of going to Google’s web site. You can redirect existing domains to your machine. 17 as the top level domain (which are not valid top level domains). It just needs to be composed of letters (a-z), numbers (0-9), hyphens (- but not as the start or end of a name) and periods (.). Your address does need to be a “valid” top level domain (i.e.com. Redirecting the Web Site to Your Computer This is a two step process: first, you have to redirect the web site name to your computer next, you get Apache to redirect the web site address to your installed directory. You can setup the Apache Server in XAMPP to serve up web pages as though they were actually located on instead of localhost. It does have the drawback that to access your website you have to type localhost/my-web-site, where my-web-site is actually the directory you installed your website in. You can configure and test out your website locally, instead of live somewhere on the web. Installing XAMPP allows you to develop, test, and play around with web server code on your local machine. This means that you won’t be able to save changes made to the hosts file.įor instructions on opening the hosts file for reading and writing please see this article. UPDATE 17-March-2012:If you are running Windows 7 (and possibly Vista) the default security settings prevent you from running applications with administrative privileges.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |