We will learn how to build a domain or a subdomain on our localhost Xampp server for php in today’s article.
We’ll break it down into two parts.
We will register our domain/subdomain with the server in step 1 and build a subdomain in step 2.
Don’t worry, we’re not going to acquire any domains or anything; we’ll do everything on our Windows OS.
So let’s get started by following the instructions below:- :-
Register our domain/subdomain to the server
- Open File Manager using admin
- Go to C drive
- In the C drive go to Windows folder then System32 folder
- After that go to the drivers folder and then etc folder.
Now we have arrived to “C:\Windows\System32\drivers\etc” folder
- Open hosts file
If you are unable to edit hosts file then you have to change the permission of the file. To change the permission just follow the below steps
- Right click on the file
- Go to properties
- Go to security
- Click on Edit
- Then in Full control column check the checkbox below allow
- Then click on ok
- Then follow the step 6
- Paste the following code at bottom of the page
Now we will create a Subdomain/Domain
- Navigate to the folder where Xampp is installed.
- Then go to the folder apache
- Then go to the folder conf
- Then go to the folder extra
- Now our folder path will be
“xampp\apache\conf\extra”
- Now open the file httpd-vhosts and past the following code
DocumentRoot “C:\xampp\htdocs\foldername”
ServerName test.local
Now we have successfully created the domain in our system.
The last step is to restart the xampp server and enjoy domain in your pc.
Please comment below for any help.
Related Posts:
- Integrate Razorpay Payment Gateway in PhP CodeIgniter
- Create a Subscription in Stripe Payment Gateway In…
- Upload data using excel sheet in CodeIgniter
- Encryption and decryption in PhP
- Php code to create certificate and export as jpg image
- File and Folder size in php CI
- Difference between two strtotime and date in php and…
- Upload and Extract zip file in Code Igniter
- Finding a file with a specific name with any…
- Select data from sql where field not equal to zero…