0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

URLの構造と構成要素

Posted at

1. URLの基本構造

URLは以下の要素で構成される:[^1] [^2] [^3]

scheme://username:password@hostname:port/path?query#fragment

2. 構成要素の詳細

  • **スキーム(scheme):**通信プロトコルを指定
    • http, https, ftp, mailto等
    • スキーム名の後に「://」を付加
  • 認証情報(username:password):[^3]
    • オプショナルな要素
    • 「@」記号の前に配置
  • ホスト名(hostname):
    • サーバーのドメイン名またはIPアドレス
    • example.comなど
  • ポート番号(port):
    • オプショナルな要素
    • 「:」の後に数値で指定
    • 省略時は標準ポートを使用(http:80, https:443)
  • パス(path):
    • リソースの場所を指定
    • 「/」で区切られたセグメント
  • クエリ文字列(query):
    • 「?」の後に配置
    • key=value形式のパラメータ
    • 複数のパラメータは「&」で連結
  • フラグメント(fragment):
    • 「#」の後に配置
    • ページ内の特定位置を指定

3. URLの例

https://user:pass@example.com:8080/path/to/page?key1=value1&key2=value2#section1

4. URLエンコーディング

URLで使用できない文字は以下のようにエンコードする:[^4]

  • スペース: %20 または +
  • 日本語などの非ASCII文字: %エンコーディング
  • 予約文字(:, /, ?, #等): %エンコーディング

参照

[^1] https://blog.hubspot.jp/marketing/parts-url
[^2] https://support.pendo.io/hc/ja/articles/360032293371-ページのタグ付けを行うURL
[^3] https://build-web.org/programming/basic-authentication/
[^4] https://www.asahi-net.or.jp/~ax2s-kmtn/ref/uric.html

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?