Menu

In this tutorial I will show you how to change localhost to custom domain name in XAMPP server. 

Before:

http://localhost/mysite

after:

http://codeigniter-tutorial.test

 

Step 1

Open XAMPP Control Panel. Then Click Config button > dropdown select < Browse > [Apache] . It will bring you to apache folder.

 

Step 2

Open httpd-vhosts.conf file inside conf/extra directory.

Don't forget backup conf file before edit something.  

Enter following code, in the of file:

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/mysite"
    ServerName codeigniter-tutorial.test
</VirtualHost>

DocumentRoot means your folder project location.
ServerName means your custom domain name. (Note: you can't use .dev domain it will give you error. Read More )

Save and close

 

Step 3

Backup hosts file before edit something stupid.

Go to C:\Windows\System32\drivers\etc directory. Open hosts file as administrator to edit.

 Add this line in the end of file:

127.0.0.1        codeigniter-tutorial.test

Note: Please make your domain name same with apache conf.

Save and close

 

Step 4

Restart Apache module in XAMPP control panel. Click Stop button then click Start button again. :P
Open in your browser http://codeigniter-tutorial.test 

Easy right?
If you have problem just comment bellow and I will try assist you. Don't forget share it to your friend.