Làm cách nào để liên kết đến một thư mục trong một thư mục trong html?

Khi nói đến đường dẫn cho một trang web, chúng cũng biến thành URL. Vì vậy, đường dẫn và URL hoàn toàn giống nhau khi tạo trang web

☛ Tham khảo quy ước đặt tên

Thư mục gốc

Để bắt đầu đường dẫn, chúng tôi cần hiểu cách thư mục của chúng tôi được thiết lập. Thư mục “root” là thư mục chính của trang web. Kho lưu trữ Git của chúng tôi. Nơi trang chủ của chúng tôi cư trú

Nếu hình trên thư mục gốc của chúng ta là

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
4—bạn có thể nhìn thấy nó trên thanh tiêu đề của cửa sổ

Trang chủ của chúng tôi cho trang web của chúng tôi là tệp

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
0 trực tiếp bên trong thư mục
//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
1 của chúng tôi. Đó là tập tin mặc định. Máy chủ web sẽ tự động gọi nó để hiển thị trang chủ của chúng tôi, do đó, nó phải được đặt tên là
//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
0

Đường dẫn trong cùng một thư mục

Khi tạo một đường dẫn trong cùng một thư mục, chúng ta chỉ cần chỉ định tên tệp của thư mục đó

  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    0 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    4 — Con đường.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    4
  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    0 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    7 — Con đường.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    7

Ngay cả khi chúng tôi đang ở trong một thư mục và cần truy cập một tệp khác trong cùng thư mục đó, chúng tôi chỉ cần viết tên của nó

  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    9 đến
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    00 — Đường dẫn.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    00

Chúng ta có thể bắt đầu những đường dẫn này với

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
02 và nhận được hiệu ứng tương tự

  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    0 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    7 — Con đường.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    05

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
02 là ngầm định, nghĩa là nó sẽ được thêm vào nếu chúng ta không tự thêm vào

Di chuyển vào các thư mục

Để viết một đường dẫn di chuyển vào một thư mục, chúng tôi chỉ định tên thư mục, theo sau là dấu gạch chéo lên, sau đó là tên tệp

  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    0 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    00 — Đường dẫn.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    09
  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    0 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    11 — Con đường.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    12
  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    0 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    14 — Con đường.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    15

chỉ mục thư mục con

Nếu một thư mục có tệp

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
0 của riêng nó, chúng tôi không cần chỉ định tệp đó trong đường dẫn

  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    7 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    0 — Đường dẫn.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    19

Di chuyển ra khỏi thư mục

Khi di chuyển ra khỏi thư mục, chúng tôi sử dụng

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
00, sau đó làm theo tất cả các quy tắc trên

  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    9 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    7 — Con đường.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    03
  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    9 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    11 — Con đường.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    06
  • Từ.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    9 đến.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    14 — Con đường.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    09

Nếu bạn cần xóa nhiều thư mục, chỉ cần thêm nhiều thư mục hơn

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
0

Tương đối so với. tuyệt đối

Tất cả các đường dẫn chúng tôi đã học ở trên đều có liên quan đến vị trí bạn hiện đang ở—được gọi là tài liệu tương đối

  • Nếu con đường bắt đầu bằng con số không, điều đó có nghĩa là “hãy bắt đầu từ nơi tôi đang ở và đi từ đó. ”
  • Nếu đường dẫn bắt đầu bằng
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    00, điều đó có nghĩa là “đi lên một thư mục từ vị trí của tôi và sau đó đi từ đó. ”

Nhưng chúng ta có thể rất cụ thể về con đường của mình, khiến chúng trở nên tuyệt đối

tuyệt đối

Trong đó các đường dẫn tương đối liên quan đến vị trí hiện tại, các đường dẫn tuyệt đối liên quan đến Internet và URL cấp cao nhất

  • Nếu chúng ta bắt đầu một đường dẫn với một giao thức [http[s]] thì điều đó có nghĩa là “Bắt đầu ở cấp cao nhất của Internet, thay thế mọi thứ và làm việc từ đó. ”

Nếu trang web của chúng tôi được lưu trữ tại tên miền

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
21, chúng tôi sẽ nhận được các đường dẫn sau

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg

Đây là cách chúng tôi viết đường dẫn đến các trang web khác

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
0

giao thức tương đối

Nếu chúng ta không muốn viết giao thức [https], chúng ta có thể bỏ nó đi và trình duyệt sẽ tự động thêm nó cho chúng ta

Mặc dù vậy, hãy cẩn thận vì trình duyệt sẽ thêm cùng một giao thức mà trang web của chúng tôi hiện đang chạy tại

  • Nếu chúng tôi bắt đầu một đường dẫn với
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    22, điều đó có nghĩa là “bắt đầu ngay sau giao thức, thay thế tất cả các miền và làm việc từ đó. ”
//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
1

gốc họ hàng

Nếu chúng tôi chỉ muốn viết các đường dẫn trong miền của mình nhưng có nhiều đường dẫn giống như tuyệt đối hơn, chúng tôi có thể sử dụng các đường dẫn tương đối gốc

  • Nếu chúng ta bắt đầu một đường dẫn với
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    23, điều đó có nghĩa là “bắt đầu từ tên miền gốc và làm việc từ đó. ”
//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
0

Chúng ta sử dụng những thứ này ở đâu?

Mọi nơi

  • Trong các liên kết HTML,
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    24.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    2
  • Trong thẻ hình ảnh,
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    25.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    2
  • Khi liên kết CSS,
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    24.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    4
  • Khi sử dụng
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    27 trong CSS.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    6
  • Trong thanh URL của trình duyệt của bạn để điều hướng xung quanh

  • Trong “Go to Folder…” của Finder,

    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    28

  • Dòng lệnh trên máy tính của bạn, hay còn gọi là Terminal

Tại sao nó không hoạt động trên trang web địa phương của tôi?

Một số kiểu đường dẫn khác nhau sẽ không hoạt động trên trang web địa phương của bạn nếu bạn không sử dụng máy chủ web

Lý do những thứ này không hoạt động là vì chúng tôi thường sử dụng giao thức

//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
29 để xem các trang web của chúng tôi. Nếu bạn kéo trực tiếp tệp HTML của mình vào trình duyệt, hãy xem kỹ URL, URL phải bắt đầu bằng
//prehistoric-animals.com/
//prehistoric-animals.com/plesiosaurs.html
//prehistoric-animals.com/dinosaurs/
//prehistoric-animals.com/dinosaurs/apatosaurus.html
//prehistoric-animals.com/css/main.css
//prehistoric-animals.com/images/trex.jpg
29—có nghĩa là nó chỉ có trên máy tính của bạn, không có trên Internet

  • //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    23 — gốc tương đối sẽ không hoạt động vì nó sẽ liên kết với thư mục gốc của ổ cứng của bạn chứ không phải thư mục gốc của tên miền vì không có tên miền
  • //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    22 — giao thức tương đối sẽ không hoạt động vì giao thức của bạn là
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    23, trong khi mọi thứ khác trên Web là
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    24 hoặc
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    25

Hai dạng cú pháp này đặc biệt yêu cầu máy chủ web hoạt động bình thường

tóm tắt cú pháp

Đây là cú pháp khác nhau mà bạn cần biết để xử lý các đường dẫn

  • //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    26 hoặc
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    02 — một dấu chấm + dấu gạch chéo
    Bắt đầu ở cùng một vị trí với tệp này và làm việc từ đó.
    Ngầm định, nếu bạn tham chiếu đến tên tệp không bắt đầu bằng dấu gạch chéo, e. g.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    0 giống như
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    29
  • //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    00 — dấu chấm kép + dấu gạch chéo
    Bắt đầu ở cùng vị trí với tệp này, mở một thư mục và làm việc từ đó.
    Có thể kết hợp.
    //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    41 — xuất ra hai thư mục
  • //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    23 — gạch chéo ở đầu
    Bắt đầu từ miền gốc và làm việc từ đó.
  • //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    22 — dấu gạch chéo kép ở đầu
    Bắt đầu ngay sau giao thức, thay thế tất cả các miền và làm việc từ đó.
  • //prehistoric-animals.com/
    //prehistoric-animals.com/plesiosaurs.html
    //prehistoric-animals.com/dinosaurs/
    //prehistoric-animals.com/dinosaurs/apatosaurus.html
    //prehistoric-animals.com/css/main.css
    //prehistoric-animals.com/images/trex.jpg
    
    44 — giao thức ngay từ đầu
    Bắt đầu ở cấp cao nhất của Internet, thay thế mọi thứ và làm việc từ đó.

Đường dẫn trên máy tính của bạn

Nếu bạn chỉ sử dụng những đường dẫn này trên máy tính của mình, đối với “Chuyển đến Thư mục…” và Terminal, sẽ có một số khác biệt

Chủ Đề