HTML básico: ¿cómo establecer la ruta relativa a la carpeta actual?

Digamos que estoy actualmente en: http://example.com/folder/page.html

¿Es posible crear un enlace relativo en esta página que apunte a http://example.com/folder/ sin especificar la folder ningún lugar? (Y usando solo HTML.)

ACTUALIZACIÓN: Como resultó ./ funciona solo en el modo doctype no estricto, mientras que . funciona en ambos modos, por lo que sigue siendo una mejor respuesta en mi opinión 🙂 Gracias a todos.

Just dot está funcionandohttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. El doctype hace una diferencia, sin embargo, como a veces el https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./ también está bienhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.

 Link to this folder 

Para cualquiera que haya encontrado este hilo, el direccionamiento de las rutas relativas siempre ha creado argumentos sobre lo que es correcto o nohttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.

Dependiendo de dónde utilice la ruta a tratar, dependerá de cómo aborde la rutahttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.

En general :

https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. y https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./ hacen lo mismo, sin embargo no usarían https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. con un nombre de archivohttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. De lo contrario, el navegador solicitará https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.filenamehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.ext como un archivo del servidorhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. El método correcto sería https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./filenamehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.ext https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.

https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./ aborda la ruta un nivel desde la carpeta actualhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. Si estuviera en la ruta /cheese/crackers/yummyhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html , y su código de enlace solicitó https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./butter/spreadhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html en el documento yummyhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html , entonces estaría abordando la ruta /cheese/butter/spreadhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html , en lo que respecta al servidorhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.

/ siempre abordará la raíz del sitiohttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.

Puedes usar

  https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./ 

para significar un nivel superiorhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. Si tiene una página llamada page2https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html en la misma carpeta que pagehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html , la ruta relativa es:

  page2https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.htmlhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. 

Si tiene page2https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html en el mismo nivel con la carpeta, entonces la ruta es:

  https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/./page2https://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html 

La respuesta principal no es lo suficientemente clarahttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/. esto es lo que funcionó para mí: el formato correcto debería verse así si quiere apuntar al archivo real:

   

Esto hará que apuntes a ese archivo dentro de la misma carpeta si estás en la página http://examplehttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.com/folder/indexhttps://stackoverflow.com/questions/296873/basic-html-how-to-set-relative-path-to-current-folder/.html