Tags

From your Apache conf folder, edit the httpd.conf and look for line Virtual host. Uncomment the line by removing the hash symbol(#)


# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Next, edit the httpd-vhosts.conf

#
# Use name-based virtual hosting.
# NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any block.
#

NameVirtualHost localhost:80

DocumentRoot “D:/xampp/htdocs/”

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

## Old way

ServerName local.ceburealestate.com
ServerAlias local.ceburealestate.com
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "c:/xampp/htdocs/local.ceburealestate.com"

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

# New style

ServerName local.helloworldapp.com
ServerAlias local.helloworldapp.com
DocumentRoot "C:/phpproject/helloworldapp"

# AllowOverride All # Deprecated
# Order Allow,Deny # Deprecated
# Allow from all # Deprecated
# New way of doing it
Require all granted

Edit the Windows host file and add your custom domain name e.g, local.helloworldapp.com

$ vi "C:\Windows\System32\drivers\etc\hosts"
# localhost name resolution is handled within DNS itself.
	127.0.0.1       localhost
        127.0.0.1       local.helloworldapp.com
#	::1             localhost

Make sure to restart the server:
Go to /c/Apache24/bin directory
$ httpd -k restart

You got an error such as “Access Forbidden! You don’t have permission to access the requested directory…”
To solve this issue, you add this line: Require all granted
Kindly see the virtualHost settings of helloworldapp

Advertisements