{"id":6701,"date":"2024-02-23T11:38:55","date_gmt":"2024-02-23T06:08:55","guid":{"rendered":"https:\/\/weblizar.com\/blog\/?p=6701"},"modified":"2025-08-06T17:32:33","modified_gmt":"2025-08-06T12:02:33","slug":"how-setup-virtual-host-for-laravel-xampp-wamp","status":"publish","type":"post","link":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/","title":{"rendered":"How to Setup Virtual Host for Laravel Through Xampp Wamp"},"content":{"rendered":"<p>How to Setup Virtual Host for Laravel Through Xampp Wamp: The term Virtual Host refers to the practice of running more than one website (such as department1.company.com and department2.company.com) on a single machine. Virtual hosts can be &#8220;IP-based&#8221;, which means that we have a different IP address for every website, and &#8220;Name-based&#8221;, which means that we have multiple names running on each IP address.<\/p>\n<p>The fact that they are running on the same physical server is not apparent to the end user.<\/p>\n<p><strong>BUY NOW &#8211; Laravel Based<\/strong> &#8211; <a href=\"https:\/\/weblizar.com\/plugins\/online-exam-management\">Online exam management WordPress Plugin<\/a><\/p>\n<h2>How to Setup Virtual Host For Laravel<\/h2>\n<p>There are two types of Apache virtual host configurations:<\/p>\n<ol>\n<li>IP-Based Virtual Host<\/li>\n<li>Name-based Virtual Host<\/li>\n<\/ol>\n<h3>IP-based Virtual Host:<\/h3>\n<p>In this configuration, when you are indicating two websites (with different IP addresses) to the server that runs Apache, that physical server should have two different IP addresses configured.<\/p>\n<p>This means that the server should have two ethernet cards, each one of them configured to the IP address of the corresponding website that the Apache virtual host will be serving. But it&#8217;s not practical when you are serving a large number of websites.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Recommended Post:<\/strong><\/span>\u00a0<a title=\"How to Install Laravel \u2013 Steps to be Followed\" href=\"https:\/\/weblizar.com\/blog\/how-to-install-laravel-steps-followed\/\" rel=\"bookmark\">How to Install Laravel \u2013 Steps to be Followed<\/a><\/p>\n<h3>Name-Based Virtual Host:<\/h3>\n<p>In this configuration, when the Apache web server receives a request, it looks for the hostname in the HTTP header, and depending on the hostname, it serves different websites. This is very easy, as you need only one IP address on that physical server, but, you update the DNS with multiple website names specifying to the same IP address.<\/p>\n<p>We will read more about Virtual Host in the coming blog because the focus of this blog is how to set up Virtual Host for Laravel.<\/p>\n<p><strong>Also Read:<\/strong> <a href=\"https:\/\/intechnosoftware.com\/10-principles-of-good-website-design\/\">Top 10 Principles of good website design<\/a><\/p>\n<ol>\n<li>To set up the virtual host, we need to configure Apache&#8217;s virtual host. \u00a0We need to edit the &#8220;httpd-vhosts.conf&#8221; file. \u00a0Follow these steps to set up the virtual server:<\/li>\n<li>Navigate to\u00a0<strong>&#8220;C:\\wamp\\bin\\apache\\apache2.4.23\\conf\\extra\\httpd-vhosts.conf<\/strong><strong>&#8221; <\/strong>\u00a0[ For XAMPP<strong>\u00a0 C:\\xampp\\apache\\conf\\extra\\httpd-vhosts.conf<\/strong>\u00a0] and open the file in editor.<br \/>\nAdd these lines to the end of the file and save it:&lt;VirtualHost *:80&gt;<br \/>\nDocumentRoot &#8220;C:\/xampp\/htdocs&#8221;<br \/>\nServerName localhost<br \/>\n&lt;\/VirtualHost&gt;&lt;VirtualHost *:80&gt;<br \/>\nDocumentRoot &#8220;C:\/xampp\/htdocs\/project-name\/public&#8221;<br \/>\nServerName project-name.dev<br \/>\n&lt;\/VirtualHost&gt;<\/li>\n<li>Also, we need to edit &#8220;hosts&#8221; file. Copy &#8220;C:\\Windows\\System32\\drivers\\etc\\hosts&#8221; file to Desktop and open it in your editor. Add these lines to the end and save it:<br \/>\n127.0.0.1 localhost<br \/>\n127.0.0.1 project-name.dev (ex: 127.0.0.1 projectD.dev)<\/li>\n<li>Copy &#8220;hosts&#8221; file from Desktop and paste it back to &#8220;C:\\Windows\\System32\\drivers\\etc&#8221;.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6708 size-full aligncenter\" src=\"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/larahost.png\" alt=\"\" width=\"1216\" height=\"732\" srcset=\"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/larahost.png 1216w, https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/larahost-300x181.png 300w, https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/larahost-768x462.png 768w, https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/larahost-1024x616.png 1024w\" sizes=\"auto, (max-width: 1216px) 100vw, 1216px\" \/><\/li>\n<li>Now, open WAMPP (XAMPP) and restart Apache server. In your browser, navigate to project-name.dev (ex: projectD.dev)<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6707 size-full aligncenter\" src=\"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/lara3.png\" alt=\"\" width=\"1594\" height=\"774\" srcset=\"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/lara3.png 1594w, https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/lara3-300x146.png 300w, https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/lara3-768x373.png 768w, https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/lara3-1024x497.png 1024w\" sizes=\"auto, (max-width: 1594px) 100vw, 1594px\" \/><\/p>\n<p>This is how you can set up a virtual host in your Xamp or Wamp server for <a href=\"https:\/\/laravel.com\/\">Laravel<\/a>.<\/p>\n<p>I hope you have enjoyed these simple steps and if you have any problems, please feel free to post your queries in the comment section below. \t\t<div class=\"wp-faq-schema-wrap\">\n\t\t\t\t\t\t\t<h2>FAQs\u201d<\/h2>\n\t\t\t\t\t\t<div class=\"wp-faq-schema-items\">\n\t\t\t\t\t\t\t\t\t<h3>How to setup Laravel with xampp?<\/h3>\n\t\t\t\t\t<div class=\"\">\n\t\t\t\t\t\t<p>1. Install XAMPP.<br \/>\n2. Download Composer.<br \/>\n3. Open terminal, create Laravel project: `composer create-project --prefer-dist laravel\/laravel your-project-name`.<br \/>\n4. Configure database in `.env` file.<br \/>\n5. Run `php artisan migrate` for database setup.<br \/>\n6. Start Laravel server: `php artisan serve`.<br \/>\n7. Access your Laravel app at `http:\/\/localhost:8000`.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<h3>How to set up virtual host in Laravel?<\/h3>\n\t\t\t\t\t<div class=\"\">\n\t\t\t\t\t\t<p>To set up a virtual host in Laravel with XAMPP, you need to make changes to the Apache configuration. Open the `httpd.conf` file in your XAMPP installation, uncomment the line `Include conf\/extra\/httpd-vhosts.conf`, and then edit the `httpd-vhosts.conf` file in the `extra` folder. Add a `` entry specifying the `DocumentRoot` as your Laravel project's public folder and set the `ServerName` to your desired local domain. Save the changes, restart Apache, and don't forget to update your system's hosts file with the chosen domain. After these steps, you can access your Laravel app through the configured virtual host, providing a cleaner and more customized development environment.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Setup Virtual Host for Laravel Through Xampp Wamp: The term Virtual Host refers to the practice of running more than one website (such as department1.company.com and department2.company.com) on a single machine. Virtual hosts can be &#8220;IP-based&#8221;, which means that we have a different IP address for every website, and &#8220;Name-based&#8221;, which means that<\/p>\n","protected":false},"author":6,"featured_media":6711,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[1022],"tags":[1058,1063,1025,1026,1057,1062,1061,1060,1059],"class_list":["post-6701","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-how-to-setup-virtual-host","tag-laravel-devs","tag-laravel-tips","tag-laravel-tricks","tag-virtual-host","tag-virtual-host-benefits","tag-virtual-host-working","tag-virtual-hosting-for-laravel","tag-what-is-virtual-host"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Setup Virtual Host for Laravel Through Xampp Wamp<\/title>\n<meta name=\"description\" content=\"This article mainly describes how to setup virtual host for laravel with the help of Xampp or Wamp through some easy DIY steps for developers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Setup Virtual Host for Laravel Through Xampp Wamp\" \/>\n<meta property=\"og:description\" content=\"This article mainly describes how to setup virtual host for laravel with the help of Xampp or Wamp through some easy DIY steps for developers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/\" \/>\n<meta property=\"og:site_name\" content=\"Weblizar Blog\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/weblizarwp\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-23T06:08:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-06T12:02:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/How-to-Setup-Virtual-Host-for-Laravel-Through-Xampp-Wamp.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"weblizar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@weblizar\" \/>\n<meta name=\"twitter:site\" content=\"@weblizar\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"weblizar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Setup Virtual Host for Laravel Through Xampp Wamp","description":"This article mainly describes how to setup virtual host for laravel with the help of Xampp or Wamp through some easy DIY steps for developers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/","og_locale":"en_US","og_type":"article","og_title":"How to Setup Virtual Host for Laravel Through Xampp Wamp","og_description":"This article mainly describes how to setup virtual host for laravel with the help of Xampp or Wamp through some easy DIY steps for developers.","og_url":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/","og_site_name":"Weblizar Blog","article_publisher":"http:\/\/www.facebook.com\/weblizarwp","article_published_time":"2024-02-23T06:08:55+00:00","article_modified_time":"2025-08-06T12:02:33+00:00","og_image":[{"width":900,"height":563,"url":"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/How-to-Setup-Virtual-Host-for-Laravel-Through-Xampp-Wamp.jpg","type":"image\/jpeg"}],"author":"weblizar","twitter_card":"summary_large_image","twitter_creator":"@weblizar","twitter_site":"@weblizar","twitter_misc":{"Written by":"weblizar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/#article","isPartOf":{"@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/"},"author":{"name":"weblizar","@id":"https:\/\/weblizar.com\/blog\/#\/schema\/person\/9bf5f8659333cb8cb24b2a4f6799bb6a"},"headline":"How to Setup Virtual Host for Laravel Through Xampp Wamp","datePublished":"2024-02-23T06:08:55+00:00","dateModified":"2025-08-06T12:02:33+00:00","mainEntityOfPage":{"@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/"},"wordCount":526,"commentCount":0,"image":{"@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/#primaryimage"},"thumbnailUrl":"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/How-to-Setup-Virtual-Host-for-Laravel-Through-Xampp-Wamp.jpg","keywords":["how to setup virtual host","laravel devs","laravel tips","laravel tricks","virtual host","virtual host benefits","virtual host working","virtual hosting for laravel","what is virtual host"],"articleSection":["Laravel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/","url":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/","name":"How to Setup Virtual Host for Laravel Through Xampp Wamp","isPartOf":{"@id":"https:\/\/weblizar.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/#primaryimage"},"image":{"@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/#primaryimage"},"thumbnailUrl":"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/How-to-Setup-Virtual-Host-for-Laravel-Through-Xampp-Wamp.jpg","datePublished":"2024-02-23T06:08:55+00:00","dateModified":"2025-08-06T12:02:33+00:00","author":{"@id":"https:\/\/weblizar.com\/blog\/#\/schema\/person\/9bf5f8659333cb8cb24b2a4f6799bb6a"},"description":"This article mainly describes how to setup virtual host for laravel with the help of Xampp or Wamp through some easy DIY steps for developers.","breadcrumb":{"@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/#primaryimage","url":"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/How-to-Setup-Virtual-Host-for-Laravel-Through-Xampp-Wamp.jpg","contentUrl":"https:\/\/weblizar.com\/blog\/wp-content\/uploads\/2017\/11\/How-to-Setup-Virtual-Host-for-Laravel-Through-Xampp-Wamp.jpg","width":900,"height":563,"caption":"How to Setup Virtual Host for Laravel Through Xampp Wamp"},{"@type":"BreadcrumbList","@id":"https:\/\/weblizar.com\/blog\/how-setup-virtual-host-for-laravel-xampp-wamp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/weblizar.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Setup Virtual Host for Laravel Through Xampp Wamp"}]},{"@type":"WebSite","@id":"https:\/\/weblizar.com\/blog\/#website","url":"https:\/\/weblizar.com\/blog\/","name":"Weblizar Blog","description":"Update yourself with all the latest tech news revolving around wordpress all at one place","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/weblizar.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/weblizar.com\/blog\/#\/schema\/person\/9bf5f8659333cb8cb24b2a4f6799bb6a","name":"weblizar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/928b1041d6ec32e582ed281b0bd3d658fab1399de7a4b9b7de1d9fa9cf0da608?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/928b1041d6ec32e582ed281b0bd3d658fab1399de7a4b9b7de1d9fa9cf0da608?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/928b1041d6ec32e582ed281b0bd3d658fab1399de7a4b9b7de1d9fa9cf0da608?s=96&d=mm&r=g","caption":"weblizar"}}]}},"_links":{"self":[{"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/posts\/6701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/comments?post=6701"}],"version-history":[{"count":0,"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/posts\/6701\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/media\/6711"}],"wp:attachment":[{"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/media?parent=6701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/categories?post=6701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/weblizar.com\/blog\/wp-json\/wp\/v2\/tags?post=6701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}