Create Virtual Hosts | Windows & XAMPP | Custom URLs for localhost Projects

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Welcome to webstylepress. Create  a virtual host to manage URLs of   local projects effectively by using xampp and  windows let's say i have two folders in XAMPP   project 1 and project dash 2. i have got these  folders in xampp st docs test dash projects   each one of these has got a single file  index.php to run files from these folders   i will have to fire up xampp server  i will only need to run apache server now these are urls for the dummy  projects that i have got right now localhost slash test projects test dash  projects slash project dash one this is project   one and then i have got this your localhost  slash test dash projects slash project dash 2. how about changing these urls to something like these project 1 dot local and then project  2 dot local from these urls to these urls you can use dot me instead of local  or anything that suits your needs   to do that we will need to edit httpd dash vhosts  dot conf file from xampp and windows hosts file   so to edit httpd vhosts conf file  we'll need to go to apache folder   in xampp folder we have got apache folder and  then inside it we have got conf folder inside   it we have got extra here we have got http  dash vhosts dot conf file configuration file we'll need to add a virtual host  in this file two virtual hosts   in our case this virtual host  will take document root path for our project and new server name of our choice do not use http for server name so i will  copy this from here and paste it here we will need document root  and server name i don't need other lines here so it is the port a t port is being  listened by this amp for document root we will place this url here full path  but not like this with http and localhost   this is our test project and  this is the path that we need and then target url is this one that we want for our project  we don't need http here similarly we need another virtual host   this time we have got project two and here  project two dot local this is destination url   these are the urls that we've got currently  and we're turning these urls into these urls save file so this was httpd-vhosts.conf file in xampp apache conf extra folder this is the path that i have got i have xampp  installed in e drive and then we've got apache   and then conf and then extra now we will need to  edit hosts file in windows so the path is this one c drive windows system 32 drivers and then etc this is the path in c drive windows  system 32 drivers and then etc   this folder has got this host's file you  cannot edit it directly and the operating   system won't allow you to save it at this  location so i have copied this hosts file   here i will edit it here and  then i will replace this file   do not forget to take backup for the host's file  this file will resist changes at this location   as i have mentioned you can copy this file to  some other location edit it and replace it in   this folder in this file we will add few new lines  so i have copied this file here let's open it right now it looks like this we will have  to add hosts here first of all we will need   this we are defining that this is our local host  and then again for the same ip address we will add these two urls without http again like this will go here and two we have got two virtual hosts right  so this is the localhost ip address and   then we are assigning localhost to  it this name and then same ip address   our first project and then our second project  you can add as many projects as you like here   save the file and now let's copy this file from  here and paste it in etc folder will replace hosts   file so here in httpd vhost.conf and in hosts file  do not use http with this url and with this url   basically server name will be used without  http and then i have used dot local here   don't use dot dev and url it might give  you message that connection not private   you can use anything else instead of dot dev   like dot local dot me anything else now i will  need to restart apache i will stop the service   and then i will start the service again  now we have got this project1.local   this was our project now we don't need  localhost here now this url won't work anymore   and we will paste this url here http  double dot double slash project1.local   enter and as you can see this is our site at this  address running at localhost with our custom url   similarly localhost slash test dash projects  slash project dash2 won't work again object not   found 404 and now project 2 dot local will work as  expected this is project 2 and this is project one   so this is how you can change urls for your  local projects it has got advantages you can   use it to manage local urls for your projects in  case you're using a server a web server and xampp you are working with wordpress projects you are  working with php projects or larval projects   you can use this technique to add  virtual hosts in this file you can define   your own urls for your virtual  servers and you can use those urls   sometimes managers or team leads require you  to set up virtual hosts in your machine at   your job so that you can effectively manage  local projects in your pc and in this way   projects migration to live server can also  be a little bit easier all right like share   and subscribe thanks for watching this video  stay tuned and i will see you in the next one
Info
Channel: WebStylePress
Views: 10,727
Rating: undefined out of 5
Keywords: custom url for localhost project, custom localhost url, create virtual host xampp, virtual host in xampp, xampp virtual host, create virtual host, virtual host windows, virtual hosts, virtual host for wordpress, virtual host, web development, localhost, windows, xampp, configure virtual host, setup apache virtual host, virtual hosts apache, apache host configuration, apache tutorial for beginners, virtualhost, vhosts, apache vhosts, virtual host apache, hostname, Windows & XAMPP
Id: ek6bOoLMiU4
Channel Id: undefined
Length: 11min 9sec (669 seconds)
Published: Fri Jun 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.