how to change localhost to domain name in xampp

today we are going to tell you how to change localhost to the domain name in xampp because many times created our normal and collage project in our laptop in xampp software and but if you want your offline project also shows localhost to the domain on the internet throw domain follow the below steps to how to change localhost to domain name in xampp

how to change localhost to domain name in xampp


open my compuer and go this folder C:\Windows\System32\drivers\etc and edit “as Administrator” => hosts file.

AFTER go in this file path you can add below text in your file


you follow step 1 to change localhost to domain name in xampp them you Edit httpd-vhosts.conf file this file  this file path is given below

system E:\xampp\apache\conf\extra and edit httpd-vhosts.conf

then you copy the below code and save this file

<VirtualHost *:80>
 DocumentRoot e:/xampp/htdocs/phpcodez


then close your xaamp and Restart and url will load content form e:/xampp/htdocs/phpcodez thank you for reading this post

Click To Download

Host Multiple Domains (Virtual Host) in your Apache HTTP Server XAMPP?

you can watch this youtube video for easy understand or read below procces

  1. multiple domains or your single Apache server instance in my case i'm gonna be using xampp which is a cross-platform development environment that contains apache my sequel PHP and pro this process should follow similarly for other development environment such as lamp for linux man for Mac OS 10.
  2. one for Windows in this case like I said I'm gonna using xampp and as you can see here I have the exact control panel now if you have an exam I'm gonna include the link down in the description but you could also go to Apache French Arabic.
  3. download xampp from there and in exam you can use it for Windows Mac OS 10 or Linux so go ahead and download if you don't have it already now once you've downloaded it you have to go to the root of the direction of the installation in this case I have a installing my D Drive and here is the root .
  4. next is to the Apache folder and then to the config folder and finally go to the extra folder now in this folder the file were interested in is the HTTP D - free host that config file and I'm gonna open this up with Adam which is my editor of choice .
  5. but you can open it with notepad plus plus or any other type of editor just a text file and here it is so what we're gonna do now it's create two virtual hosts directives and those are going to catch the two domains that we're going to host in this example and those are going to be
  6. sandbox comm so once you open this file you'll get a pretty good example of what a big host should look like so I'm just gonna copy this and paste it down here and then these hash symbols are comments in the config files so you want to remove those all of those and we're gonna modify to fit our needs so first like I said we're going to host
  7. so the server I mean we're gonna replace that and just make sure it's just and the the document root we're going to move that from exam the Coulomb force plus XM to we're gonna create a folder for post actually let's just make it easier virtual and then .
  8. the server name is going to be example that I come again and we're just going to update the fields us we as we need so just make sure the log files have the correct name I'm gonna update that now in addition to what what the example shows on the top we're also going to use the directory directory directive so so that we can modify the default values of it that are in the other Apache configuration files.
  9. so we're going to do a self-contained directory if directive here and now we're going to do the panel which is in this case my D Drive eggs app and then virtual and just gonna close that so the first thing we're going to do is we're going to do the options then in the indexes and you can look up more information about this in the Apache diver website.
  10. but basically the next line allow override and make sure you have make sure that you follow the right spelling and syntax otherwise you can get an error when you start your server and require granted okay okay so basically what this is gonna do is this is gonna show the when are you reaching at the right treat that does not have an index file.
  11. it's gonna index all the files that are in there if it does have an index file then he will show that index file if not we'll just show the folder in there this one the allow right or what allow us to modify the directives in in a htaccess file so this is pretty useful .
  12. when you got like something like WordPress so you wanna have it you have an MVC a frame or anything in there that you want to breathe direct all the requests to a single file so that's what we're gonna have to allow alright.
  13. all directive in there and now we're gonna basically just copy this I'm just gonna copy it over and just update all the references from to sandbox comm so I'm just gonna copy this and paste all the references of example that come in this virtual host directive inside of it and just update it save it.
  14. make sure you save the file I just click on try to it ctrl s to save it but make sure you save it and now just go to your Apache control panel and just click start Apache just started right now so you can see it's running on port 80 by default and pour 443 but we're just gonna use port 80 now and let's go back to a browser and just go to .
  15. so you can see that's what we get that's not our thing and let's go to sandbox com okay so this takes you to these places now the thing that that caution is is we have it all right over reading the hosts files in Windows.
  16. we're not mapping these two domains to our actual domain so in this case like I said this is just for development purposes and we're gonna do it locally on our machine so the point of this is to allow you to actually test it on the real domains.
  17. on the real domains on your machine without actually having to FTP them to the actual server that's hosting that domain so we're gonna kind of fake the actual DNS in here and we're gonna go to the host files in your machine the path is windows on your c drive windows system 32 drivers et Cie .
  18. then what the file you're looking for is the host file now this file you might need to open it as an administrator in order to be able to alright the default values of it but what this file does if you're not familiar with it it's basically it Maps a domain name to an IP address so we're going to map
  19. sandbox comm to 127 that 0 that's your that one which is a robot IP and if we do that and it's just do it for sandbox comm now I have saved the file I opened it with as an administrator so I don't see any prompts when saving it if you see a problem when you're saving the file just make sure you open it as an administrator once again.
  20. now we've done that let's go back to refresh this and we get access forbidden which is that's pretty good and let's go back to HTTP and then sandbox and then we should get the same thing access for being another reason for that is that we haven't created those directories yet.
  21. as you can see if you click on 'contact Webmaster you can see a mail - at the bottom left where what it contains the webmasters email that we just created on the virtual host so that's pretty cool that you get all that information in there and there you can see that sandbox calm air for 3 so now let's dis fix that let's go back to the actual example directory
  22. create a new file a new folder and let's call it virtual there you go now it's going to that folder and create two new folders one called and the other one call center so now if we refresh you see it's indexing the files that's the options indices this is file directly there that it's causing this to happen but there's no files in there.
  23. we're not gonna have to create on some files so that we can actually see what's going on so I'm going to open this director disturb this directory here with Adam and I'm just gonna create a new file index.php yes it's just create a very simple PHP script that just calls the PHP info function and I'm just going to copy all this and to another file in sandbox calm .
  24. just place that and save it let's just refresh the site and refresh the site so you can see here if you go down you have the HTTP host environment variable and it's actually sandbox calm and if you go down here to document root it's actually the same document really that job we just created.
  25. let's go back to example that farm so the same thing you can see it that this is the document root and this is actually a server name so we've set it up correctly so that our system interprets the example calm add domain name and redirects it to or local IP address 127 dot 0 0 1
  26. we've done that so now let's it's actually go to the files unless you to something else so this is some the sandbox background so welcome to sandbox calm and in example calm we're just gonna do something different like eco hello and it's gonna save that and let's refresh the site and I see what we get we get that .
  27. then we get this so as you can see here you can do it on your local machine you can do you can do this so you could be development for different domains without actually having to deploy those to those files to an FTP server and if you have an an actual Apache server in your in your actual server like if you have an aversion machines running somewhere that's where you host your your domains.
  28. you want you want to do this you could also do this if you don't have an easy wizard way where you can access that so if you actually modify the virtual host file you can actually do this anywhere that it's running an Apache server and so that's it.

i hope you can understant this all information about how to change localhost to domain name in xampp

conclustion ;- in this post we learn how to change localhost to domain name in xampp thak you .

Leave a Comment