Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/249887-access-local-server/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/249887-access-local-server/#findComment-1282603
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/249887-access-local-server/#findComment-1282649
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/249887-access-local-server/#findComment-1282839
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/249887-access-local-server/#findComment-1282861
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.