Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

abduljakul-salsalani's avatar

How do I change localhost to a custom domain name like app.dev/index

I'm using Windows 8.1 and i want to change the localhost to a custom domain. And i'm on laravel 5.2. But i'm confused with the answers, and I want a more understandable answer for this. Thanks a lot

0 likes
8 replies
LeandritGo's avatar

You can do the changes on php.ini file on xampp or wamp folder. Whenever you go to localhost it will show as domain.dev

WINDOWS + WAMP solution

Step 1 Go to C:\wamp\bin\apache\Apache2.2.17\conf\ open httpd.conf file and change #Include conf/extra/httpd-vhosts.conf to Include conf/extra/httpd-vhosts.conf i.e. uncomment the line so that it can includes the virtual hosts file.

Step 2 Go to C:\wamp\bin\apache\Apache2.2.17\conf\extra and open httpd-vhosts.conf file and add the following code

DocumentRoot "C:/wamp/www/myWebsite/" ServerName myWebsite.local ServerAlias myWebsite.local <Directory "C:/wamp/www/myWebsite/"> Order allow,deny Allow from all change myWebsite.local and C:/wamp/www/myWebsite/ as per your requirements.

Step 3 Open hosts file in C:/Windows/System32/drivers/etc/ and add the following line ( Don't delete anything )

127.0.0.1 myWebsite.local change myWebsite.local as per your name requirements

Step 4 restart your server. That's it

WINDOWS + XAMPP solution

Same steps as that of WAMP just change the paths according to XAMPP which corresponds to path in WAMP

Cristian26's avatar

Install laragon to create virtual hosts super easy (the same program does it for us). Cheerz.

abduljakul-salsalani's avatar

DocumentRoot "C:/wamp/www/myWebsite/" ServerName myWebsite.local ServerAlias myWebsite.local <Directory "C:/wamp/www/myWebsite/"> Order allow,deny Allow from all change myWebsite.local and C:/wamp/www/myWebsite/ as per your requirements.

`I don't understand this part. What part should I copy ? All of this ?

Cristian26's avatar

@d3cypher Dear, you have laragon with nginx or apache to choose to download the one you want. Your laravel 5.2 project copies it to "C:\laragon\www" (with laragon closed) and when it finishes copying, you open laragon so that it creates the virtual host. After that you can enter the virtual host by following the name of the project folder (name_folder.dev). I've been using the program for almost 1 year and it's certainly the best suite I've tried in Windows. Regards.

Please or to participate in this conversation.