You can create a virtual host on your local system or your sever. i.e. you can have http://trial/ instead of http://localhost/trial/ where trial is the name of the directory that contains the website.
Here are the steps for creating virtual host on your sever:
1) open the host file and edit it as follows:
the host file is found at C:\WINDOWS\system32\drivers\etc\hosts for windows
open the file and add the following code to the bottom of the file on a new line
2) Now open the httpd.conf file under the apache/bin/conf/ directory
and add the following code : # Virtual hosts
or if already present then please uncomment the following line
: Include conf/extra/httpd-vhosts.conf
i.e. remove the # from the front of the line
3) Open apache/bin/conf/extra/httpd-vhosts.conf file
if not present create directory extra under
and create a file httpd-vhosts.conf file
and add this code to the file:
# Virtual Hosts
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn’t need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
# Please see the documentation at
# for further details before you try to setup virtual hosts.
# You may use the command line option ‘-S’ to verify your virtual host
Allow from all
# Use name-based virtual hosting.
# 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 <VirtualHost> block.
# ServerAdmin email@example.com
# DocumentRoot “C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.localhost”
# ServerName dummy-host.localhost
# ServerAlias http://www.dummy-host.localhost
# ErrorLog “logs/dummy-host.localhost-error.log”
# CustomLog “logs/dummy-host.localhost-access.log” common
# ServerAdmin firstname.lastname@example.org
# DocumentRoot “C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost”
# ServerName dummy-host2.localhost
# ErrorLog “logs/dummy-host2.localhost-error.log”
# CustomLog “logs/dummy-host2.localhost-access.log” common
if the file is present then please add the following lines at the bottom of the file
4) restart your apache services and just type http://trial/ into the address bar of your browser and it will work
If you face any problem with this please feel free to contact me. I’ll try to resolve your problem as soon as possible.