How to change localhost to domain name in xampp


Change localhost to domain name in xampp

Let us change localhost to custom domain name in XAMPP server step by step –

Step 1. Amend hosts file in windows

Open the hosts file located in folder at C:\Windows\System32\drivers\etc and right click hosts file and select edit “as Administrator” . Now add these line of codes in it and save the file –

127.0.0.1 www.yourdomainname.com

( Replace www.yourdomainname.com with your required domain name )

Step 2. Edit httpd-vhosts.conf file in XAMPP installation.

For example you can find this file in this folder here -> ( F:\xampp\apache\conf\extra )
Once you locate the file then edit httpd-vhosts.conf  and add these lines of code and save the file

 

<VirtualHost *:80>

ServerName yourdomainname.com

ServerAlias www.yourdomainname.com

DocumentRoot e:/xampp/htdocs/your-website-root-folder-name

</VirtualHost>

( Replace www.yourdomainname.com with your required domain name )

Step 3. If you want to access your site over https edit httpd-vhosts.conf file

You can find this file in this folder here -> ( F:\xampp\apache\conf\extra ).

To make a site to load over https you need to add below line to httpd-vhosts.conf

<VirtualHost_default_:443>
DocumentRoot "e:/xampp/htdocs/your-website-root-folder-name"
ServerName www.yourdomainname.com:443
ServerAlias yourdomainname.com:443
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>
Note: Add proper ssl certificates to make it secure

Step 3. Now restart XAMPP and check the setup.

Now test it by visiting www.yourdomainname.com domain you set up. If you followed the steps carefully, you should be able to see the content of the site in your browser.

Share on: Share YogiRaj B.Ed Study Notes on twitter Share YogiRaj B.Ed Study Notes on facebook Share YogiRaj B.Ed Study Notes on WhatsApp
National flower of India | National symbols of India
National flower of India | National symbols of India

National Flower of India
Lotus is the National Flower of India. Lotus who’s scientific name is Nelumbo Nucifera Gaertn, is a holly flower and occupies a unique and specific position in the art and mythology of ancient India. Lotus is an auspicious symbol in Indian culture.

Read full article
Bharat Ratna | The highest civilian honour of the Republic of India
Bharat Ratna | The highest civilian honour of the Republic of India

Bharat Ratna Award
Bharat Ratna award is the highest civilian honour of the Republic of India. Instituted and started on 2 January 1954, the award is conferred without distinction of race, occupation, position, or sex, in recognition of “exceptional service or performance of the highest order”.

Read full article
Hosts file windows 10
Hosts file windows 10

What is Hosts file ?
Hosts file is an systems file of a operating system that maps hostnames to IP addresses. It is a plain text file.
Purpose of Hosts file – The hosts file assists in addressing network nodes in a computer network.

Read full article
SQL Server installation
SQL Server installation

SQL Server installation guide
This article will explain how to install the SQL Server 2019 Developer Edition and SQL Server Management Studio (SSMS) step by step.
Install SQL Server 2019 Developer Edition in windows

Read full article

Some important study notes