Create Multiple Domain & Localhost using ETC File.

Create Multiple Domain & Localhost using ETC File

Add following lines in hosts located at : C:\Windows\System32\drivers\etc

127.0.0.1 localhost ansari.com
127.0.0.1 localhost ansari.net
127.0.0.1 localhost ansari.in


add following lines in httpd-vhosts.conf located in xampp folder : C:\xampp\apache\conf\extra

<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:\xampp\htdocs\ansari.com"
    ServerName ansari.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:\xampp\htdocs\ansari.in"
    ServerName ansari.in
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:\xampp\htdocs\ansari.net"
    ServerName ansari.net
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "C:/xampp/htdocs/"
    ServerName localhost
    ##ServerAlias www.dummy-host.example.com
    ##ErrorLog "logs/dummy-host.example.com-error.log"
    ##CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

make folder named ansari.com in C:\xampp\htdocs
make folder named ansari.in in C:\xampp\htdocs
make folder named  ansari.net in C:\xampp\htdocs

make index.php in every folder

and finally run:

open browser and brows ansari.com
open browser and brows ansari.in
open browser and brows ansari.net
open browser and brows localhost

Redirecting a Web Site in Details...!!!

You can redirect a web site to another site using the same method as described above for blocking, except replace 127.0.0.1 by the target site’s IP address. For example, suppose you want to redirect your browser to www.google.com whenever someone types www.facebook.com in the browser address bar, then follows these steps :

    Open hosts file in Windows’ Notepad as described in the blocking section step 1 for your version of Windows (see above).
    Find out IP address of www.google.com using this article : Find the IP Address of a Website. (IP address is found out to be 74.125.53.100)
    Start editing at the end of the HOSTS file : Press Enter to start a new line. Type 74.125.53.100, press TAB key once followed by facebook.com. Save the hosts file.

Now whenever you (or someone else) types in your browser’s address bar www.facebook.com, he/she will be redirected to www.google.com. You can follow the same technique on any other websites.

Example:

192.168.1.1 router.com
192.168.1.1 www.router.com

#redirect google to facebook ping google.com and use this ip for redirection

google ip facebook.com
google ip www.facebook.com

Create Website Shortcuts

You can also use this trick to create “shortcuts” that quickly access websites from any program on your computer.
For example, if you’re a Twitter addict, you can associate “t” with Twitter – type t in any web browser’s address bar and you’ll instantly end up at Twitter.

#ping twitter.com and use this ip for redirection

127.0.0.1 localhost Ansari.com

Single Hostname:

127.0.0.1    Ansari.com     # redirects example to example ip
192.168.192.222    Ansari.com     # redirects example to example ip

Double Hostnames:

127.0.0.1    Ansari.com     Ansari.net    # redirects examples to example ip
192.168.192.222    Ansari.com     Ansari.net    # redirects examples to example ip

Triple Hostnames:

127.0.0.1 localhost Ansari.com ansari.net # redirects all examples to example ip
192.168.192.222 localhost Ansari.com ansari.net # redirects all examples to example ip
SHARE

Ibrar Ansari

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment