Renaming “localhost” URL to custom URL in WAMP or XAMPP

Web Programmer and Developer are very much familiar with the local development environment URL “localhost”. But seeing the same URL sometimes made us boring and wish to have a custom URL. Many of you may have the desire that instead of “localhost”, it could be something else! Right?

Let’s figure out the new URL first, we may name it development.rs. Don’t confused with rs. It’s mean RangpurSource, my company name. So, we’re going to set our new custom local development environment URL to development.rs from localhost.

Before begin, note that I’m working with the WAMP, so all the “www” will be replaced with “htdocs” if you’re using XAMPP.

So, Let’s BEGINS –

Step 1

Go to C:\wamp\bin\apache\Apache2.2.17\conf\ and open httpd.conf file and change #Include conf/extra/httpd-vhosts.conf to Include conf/extra/httpd-vhosts.conf. Just uncomment the line so that it can include the virtual hosts file.

Step 2

Go to C:\wamp\bin\apache\Apache2.2.17\conf\extra and open httpd-vhosts.conf file and add the following code


<VirtualHost development.rs>
DocumentRoot "C:/wamp/www/"
ServerName development.rs
ServerAlias development.rs
<Directory "C:/wamp/www/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

 

Change development.rs and C:/wamp/www/ as per your requirements.

Step 3

Open hosts file in C:/Windows/System32/drivers/etc/ and add the following line (Don’t delete anything )

127.0.0.1 development.rs Or replace 127.0.0.1 locahost to 127.0.0.1 development.rs

You maybe got an error called access denied or file cannot be edited and save, this is because of windows file security. Just edit the file as an administrator mode and you’ll be getting what you’ve expected.

Change development.rs as per your name requirements

Step 4

Restart your server. That’s it. 🙂

Let’s share your opinion if it works for you.