開発で localhost とブラウザに打つのが面倒なので短くしてみた
what
Windows環境で、開発時にブラウザでアクセスするときに、 localhost とURL入力欄に入力していて、今や手が無意識に動きますが、意識してみると、「けっこうめんどう・・・」と思ったので、hosts ファイルを使って短くしてみた。
環境
OS : Microsoft Windows XP Professional Version 2002 Servicde Pack 3
Web Server : Webrick
ブラウザ : Firefox 3.0.1
hostsファイルの場所
Windows XP の場合、hosts ファイルは以下にあります。
C:\WINDOWS\system32\drivers\etc\hosts
hostsファイルって何?という方はこちら⇒hosts - Wikipedia
hostsファイルの中身
こんな感じなっています。
- hosts
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
localhost を l にしてみる
- hostsファイルの編集
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
上記のように編集します。これで準備OK。