Custom url domain in Xampp

If you are developing website in Xampp, you can use custom domain instead of localhost or 127.0.0.1. 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.

127.0.0.1 mywebsite.local
127.0.0.1 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
</VirtualHost>

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
    </Directory>
</VirtualHost>

Finishing

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.

Laravel login using username or email

Laravel comes with their own auth system, so you don’t have to build login, registration, and authentication system from scratch.

By default, Laravel uses email for authentication. If you want to use username, you have to make little tweak to your controller as explained in their documentation.

But, what if you want to use either email or username for authentication? In this post, I’ll show you how to do that.

Continue reading Laravel login using username or email