Custom url domain in Xampp

If you are developing website in Xampp, you can use custom domain instead of localhost or You can make url like http://mydomain.local as an url for you local development.

Prepare project

I’m assuming you have website project directory in C:/xampp/htdocs/mywebsite. We want to use url http://mydomain.local. I like using .local TLD to differentiate it with actual internet url. Then, add this line in the bottom.

Edit hosts file

Open C:\Windows\System32\drivers\etc\hosts. You need Administrator Access to edit this file. mywebsite.local www.mywebsite.local

Edit httpd-vhosts.conf

This file is located in C:\xampp\apache\conf\extra\httpd-vhosts.conf. Add this code to the bottom.

<VirtualHost *:80>
  DocumentRoot C:/xampp/htdocs/
  ServerName localhost

Then, add this code and adjust with your projects.

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/mywebsite"
    ServerName mywebsite.local
    ServerAlias www.mywebsite.local
    <Directory "C:/xampp/htdocs/mywebsite">
        AllowOverride All
        Require all granted


You are done. Start or restart your Apache server. Go to http://mywebsite.local to test it. If you have any problems, drop the comments below.

SocketException: OS Error: Connection refused, errno = 111

I got this weird error when developing flutter app in windows. I have set my local apache as my API server. When I tested my API in Postman, everything is okay. Error appears when I tested API on my app with emulator.

Turn out, the problem is from emulator. Android emulator can’t communicate with or localhost. The solution is just change localhost to This IP is special alias to your host loopback interface.

You can read more about this in this docs. –>

Snap vector direction to nearest axis

I have this case when I need to get my character direction is snapped to the nearest axis. Kinda look like this.

My solution is to find the largest axis absolute value of axis. Then, change the largest one to 1 and the others 2 with 0. Change largest axis sign with its original sign.

Example, we have Vector3(-0.5f, 0.1f, 0). The snapped direction is Vector3(-1,0,0).

Vector3 SnappedToNearestAxis(Vector3 direction){
    float x = Abs(direction.x);
    float y = Abs(direction.y);
    float z = Abs(direction.z);
    if (x > y && x > z){
        return Vector3(Sign(direction.x),0,0);
    } else if (y > x && y > z){
        return Vector3(0,Sign(direction.y),0);
    } else {
        return Vector3(0,0,Sign(direction.z));

Productivity tips : Don’t place your distracting apps on front screen!

In this era of internet addiction, checking phone regularly is unsurprisingly common and it messes up your productivity.  One of the solutions is to make it difficult to reach these apps (Instagram, Twitter, FB, etc).

In order to do this, you must place these apps away from the front screen, put them in one folder named “Useless apps”. It doesn’t always work, but at least extra efforts to reach these apps will give you time to reconsider your decision.

Fill your front screen with “good” apps like your fitness/workout apps, todo list, or any productivity apps.

I got this idea from Reddit. Hope it helps.