http://localhost/yourproject. A virtual host lets you assign a custom local domain — like myproject.local — so each project gets its own URL and its own document root. Bearsampp creates the Apache configuration for you; you just need to add one line to your Windows hosts file.
Create the virtual host
Open the Add virtual host dialog
Right-click the Bearsampp tray icon, hover over Apache, and click Add a virtual host.
Enter a server name
In the Server name field, type your local domain. Use a valid domain format such as
myproject.local. Bearsampp validates the input and will not save a plain alphanumeric name without dots.Set the document root
Click Browse next to the Document root field and select the folder that contains your project files.
Save the virtual host
Click Save. Bearsampp:
- Creates an Apache virtual host config file for your domain
- Generates an SSL certificate for
myproject.localautomatically - Restarts Apache to apply the changes
Add the domain to your hosts file
Windows does not know aboutmyproject.local yet. You need to tell it to resolve the domain to your local machine by editing the system hosts file.
Open Notepad as Administrator
Press the Windows key, type
Notepad, right-click it in the search results, and select Run as administrator.Open the hosts file
In Notepad, go to File → Open and navigate to:Make sure the file type filter is set to All Files so the
hosts file (which has no extension) is visible.Save the file
Save the file in Notepad. Because you opened Notepad as Administrator, you can save directly to
System32\drivers\etc\.After editing the hosts file, your browser may still resolve the old address for a short time due to DNS caching. To clear it immediately, open a Command Prompt and run:
