Skip to main content
By default, you access your projects under 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

1

Open the Add virtual host dialog

Right-click the Bearsampp tray icon, hover over Apache, and click Add a virtual host.
2

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.
3

Set the document root

Click Browse next to the Document root field and select the folder that contains your project files.
4

Save the virtual host

Click Save. Bearsampp:
  • Creates an Apache virtual host config file for your domain
  • Generates an SSL certificate for myproject.local automatically
  • Restarts Apache to apply the changes
A confirmation dialog tells you the virtual host was created and reminds you to add the domain to your hosts file.

Add the domain to your hosts file

Windows does not know about myproject.local yet. You need to tell it to resolve the domain to your local machine by editing the system hosts file.
1

Open Notepad as Administrator

Press the Windows key, type Notepad, right-click it in the search results, and select Run as administrator.
2

Open the hosts file

In Notepad, go to File → Open and navigate to:
C:\Windows\System32\drivers\etc\hosts
Make sure the file type filter is set to All Files so the hosts file (which has no extension) is visible.
3

Add your domain entry

Scroll to the bottom of the file and add a new line:
127.0.0.1  myproject.local
4

Save the file

Save the file in Notepad. Because you opened Notepad as Administrator, you can save directly to System32\drivers\etc\.
5

Open your local domain in a browser

Navigate to http://myproject.local or https://myproject.local. Your project should load immediately.
Bearsampp includes a built-in HostsEditor tool that provides a simpler interface for editing the hosts file. Access it from the tray icon under Tools → HostsEditor. It handles the Administrator permissions automatically.
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:
ipconfig /flushdns
The server name must be a valid domain format — it must contain at least one dot (for example myproject.local). A plain name like myproject is not valid and Bearsampp will reject it.