href adds unwanted '.pdf' to path provided

I have following code in my tex file.

\\href{DEListComparison/inputFilesForGENE_E/}{link caption} \\


The link in the output pdf file turn out to be *DEListComparison/inputFilesForGENE_E/.pdf*. I got unnecessary .pdf in the link. Is this a bug or I did something stupid? How can it be resolved ?

• Is DEListComparison/inputFilesForGENE_E/ a complete URL string? If so, try prefixing http:// to the string. If it's something else, please advise. (It would appear that hyperref thinks it's a shortcut to a file, with extension .pdf, located somewhere on your computer.)
– Mico
Jan 16, 2014 at 6:45
• it is a relative url of a directory which is in same root directory as the output pdf file (generated by latex). Jan 16, 2014 at 6:52

There is an ambiguity in \href between a file link and an incomplete relative URL without protocol. Package hyperref chooses the former.

The following example provides macro \hrefurl that directly chooses the URL link type:

\documentclass{article}
\usepackage{hyperref}

\makeatletter
\providecommand*{\hrefurl}{\hyper@normalise\hrefurl@}
\makeatother

\begin{document}

/A <<