# \hyperbaseurl works for .html, but not for .pdf

I have a webpage where I keep my PDF documents which are connected with other HTML pages and PDFs using hyperlinks.

All of my PDFs have command \hyperbaseurl{http://ziga-lausegger.netau.net/} at the top. This command should prepended base url to any other \href{} hyperlinks in documents. But I noticed that if:

• \href{} command ends with .html like \href{foo.html} base url is prepended,
• \href{} command ends with .pdf like \href{foo.pdf} base url is NOT prepended.

What would be the source of my problems, and how to fix this. Is this a BUG with hyperref package?

-

The hyperref packages auto-detects the difference between a link to a webpage and a link to a file: with the standard settings, you will see this as different border colours for the links. The \hyperbaseurl macro is about URLs, so applies to links which are detected as web pages but not to those detected as files (which are treated as local).

You can disable this difference in behaviour by setting extension to an empty value:

\documentclass{article}
\usepackage{hyperref,trace}
\hyperbaseurl{http://www.foo.bar/}
\hypersetup{extension = }
\begin{document}
\href{foo.html}{text} text \href{foo.pdf}{text}
\end{document}

-
Thank you this saves my problem perfectly! – 71GA Sep 27 '11 at 21:02
Can you tell me only how can i make all hyperrefs in document colored, as it happens that in PDF viewer links are colored, but while opened in browser (Chrome, Firefox) they are not. I am familliar with color package and have some of my colors already defined. – 71GA Sep 27 '11 at 22:09
@71GA Please post a new question for this (it helps to keep the site organised), including a minimal example. I'm not quite sure what you want to colour and in what way. – Joseph Wright Sep 28 '11 at 5:42