<?xml version="1.0" encoding="UTF-8"?>
<!--
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->
<helpdocument version="1.0">
<meta>
<topic id="textsharedguidehyperlink_rel_absxml" indexer="include" status="PUBLISH">
<title id="tit">Relative and Absolute Links</title>
<filename>/text/shared/guide/hyperlink_rel_abs.xhp</filename>
</topic>
</meta>
<body>
<bookmark branch="index" id="bm_id3147399"><bookmark_value>absolute hyperlinks</bookmark_value>
<bookmark_value>relative hyperlinks</bookmark_value>
<bookmark_value>hyperlinks; relative and absolute</bookmark_value>
<bookmark_value>hyperlinks, see also links</bookmark_value>
</bookmark>
<h1 id="hd_id3147399"><variable id="hyperlink_rel_abs"><link href="text/shared/guide/hyperlink_rel_abs.xhp">Relative and Absolute Links</link>
</variable></h1>
<paragraph role="paragraph" id="par_id3153345">When you include hyperlinks, two factors must be taken into account: whether they are set as relative or absolute on saving, and whether or not the file is present.</paragraph>
<list type="unordered">
<listitem>
<paragraph role="listitem" id="par_id3147008">Choose <switchinline select="sys"><caseinline select="MAC">%PRODUCTNAME - Preferences</caseinline><defaultinline>Tools - Options</defaultinline></switchinline> - <link href="text/shared/optionen/01010200.xhp"><emph>Load/Save - General</emph></link> and specify in the <emph>Save URLs relative to</emph> field if $[officename] creates <link href="text/shared/00/00000005.xhp#saving">relative or absolute hyperlinks</link>. Relative linking is only possible when the document you are working on and the link destination are on the same drive.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3145382">You should create the same directory structure on your hard disk as that which exists in the web space hosted by your Internet provider. Call the root directory for the homepage on your hard disk "homepage", for example. The start file is then "index.html", the full path being "C:\homepage\index.html" (assuming Windows operating system). The URL on your Internet provider's server might then be as follows: "http://www.myprovider.com/mypage/index.html". With relative addressing, you indicate the link relative to the location of the output document. For example, if you placed all the graphics for your homepage in a subfolder called "C:\homepage\images", you would need to give the following path to access the graphic "picture.gif": "images\picture.gif". This is the relative path, starting from the location of the file "index.html". On the provider's server, you would place the picture in the folder "mypage/images". When you transfer the document "index.html" to the provider's server through the <emph>File - Save As</emph> dialog, and if you have marked the option <emph>Copy local images to Internet</emph> under <switchinline select="sys"><caseinline select="MAC"><emph>%PRODUCTNAME - Preferences</emph></caseinline><defaultinline><emph>Tools - Options</emph></defaultinline></switchinline><emph> - Load/Save - HTML Compatibility</emph>, $[officename] will automatically copy the graphic to the correct directory on the server.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3159158">An absolute path such as "C:\homepage\graphics\picture.gif" would no longer function on the provider server. Neither a server nor the computer of a reader needs to have a C hard drive: operating systems such as Unix or macOS do not recognize drive letters, and even if the folder homepage\graphics existed, your picture would not be available. It is better to use relative addressing for file links.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3154046">A link to a web page, for example, "www.example.com" or "www.myprovider.com/mypage/index.html" is an absolute link.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3155450">$[officename] also reacts differently, depending on whether the file referred to in the link exists, and where it is located. $[officename] checks every new link and sets a target and protocol automatically. The result can be seen in the generated HTML code after saving the source document.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3145317">The following rules apply: A relative reference ("graphic/picture.gif") is only possible when both files exist on the same drive. If the files are on different drives in your local file system, the absolute reference follows the "file:" protocol ("file:///data1/xyz/picture.gif"). If the files are on different servers or if the target of the link is not available, the absolute reference uses the "http:" protocol ("http://data2/abc/picture.gif").</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3153541">Be sure to organize all files for your homepage on the same drive as the start file of the homepage. In this way, $[officename] can set the protocol and target so that the reference on the server is always correct.</paragraph>
</listitem>
</list>
<warning id="par_id3153897">When you rest your mouse on a hyperlink, a help tip displays the absolute reference, since $[officename] uses absolute path names internally. The complete path and address can only be seen when you view the result of the HTML export, by loading the HTML file as "Text" or opening it with a text editor.</warning>

<section id="relatedtopics">
	<embed href="text/shared/guide/hyperlink_edit.xhp#hyperlink_edit"/>
</section>
</body>
</helpdocument>
