raduenea Posted October 27, 2011 Share Posted October 27, 2011 Hi, I have xampp install locally on my computer. What I need to change in order, for example, then I access the http://www.something.dev to open my website located in /xampp/htdocs/pic/ . If I access http://www.something-else.dev to open my website located in /xampp/htdocs/other/ . All this will be open locally ( on the same computer). Thanks Quote Link to comment https://forums.phpfreaks.com/topic/249887-access-local-server/ Share on other sites More sharing options...
trq Posted October 27, 2011 Share Posted October 27, 2011 You need to add a new virtual host for each domain. See here: http://httpd.apache.org/docs/current/vhosts/ You will then need to add some new records to your systems 'hosts' file so that your system know what ip address each domain resolves to. I'm not sure where that file exists on windows, but search for a it. Quote Link to comment https://forums.phpfreaks.com/topic/249887-access-local-server/#findComment-1282603 Share on other sites More sharing options...
cags Posted October 27, 2011 Share Posted October 27, 2011 From memory it's under Windows/System32/drivers/etc/hosts. Quote Link to comment https://forums.phpfreaks.com/topic/249887-access-local-server/#findComment-1282637 Share on other sites More sharing options...
geudrik Posted October 27, 2011 Share Posted October 27, 2011 From memory it's under Windows/System32/drivers/etc/hosts. Yes, if this is just a locally desired change, modifying your hosts file is the easiest way to go about it. Open the file C:\Windows\System32\drivers\etc\hosts and add lines in accordingly. The file has instruction on what and how to make edits. Using vhosts, by your explanation, seems to be a waste of time. I would go about this doing the following (assuming that you need server functionality - ie: php parsing) Have just your default vhost and move 'other' into your default vhost, just as a folder (eg: http://localhost/other) Then, edit your hosts file and add in lines for something-cool.dev -> localhost something-uncool.dev -> localhost/other Quote Link to comment https://forums.phpfreaks.com/topic/249887-access-local-server/#findComment-1282649 Share on other sites More sharing options...
trq Posted October 27, 2011 Share Posted October 27, 2011 Using vhosts, by your explanation, seems to be a waste of time. I would go about this doing the following (assuming that you need server functionality - ie: php parsing) Have just your default vhost and move 'other' into your default vhost, just as a folder (eg: http://localhost/other) Then, edit your hosts file and add in lines for Firstly, a hosts file (and DNS) only maps an ip to a domain, not a url. Besides, allot of applications assume they are within the document root. Quote Link to comment https://forums.phpfreaks.com/topic/249887-access-local-server/#findComment-1282839 Share on other sites More sharing options...
geudrik Posted October 27, 2011 Share Posted October 27, 2011 Using vhosts, by your explanation, seems to be a waste of time. I would go about this doing the following (assuming that you need server functionality - ie: php parsing) Have just your default vhost and move 'other' into your default vhost, just as a folder (eg: http://localhost/other) Then, edit your hosts file and add in lines for Firstly, a hosts file (and DNS) only maps an ip to a domain, not a url. Besides, allot of applications assume they are within the document root. In windows 7, you can actually map any string to any location via the hosts file. For example: I have "Music" as an entry that points to \\myserver\mymusicshare Just my .02 Note/Edit: I specify Win 7 because it's the only OS that I have screwed around with the hosts file. I cannot speak outside of Win 7 in this instance. Quote Link to comment https://forums.phpfreaks.com/topic/249887-access-local-server/#findComment-1282861 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.