# Prevent linebreak in URL in biblatex bibliography

Unlike most people, I'm trying to prevent breaking the URL in my bibliography. In the case below, the URL in the first item should stay the way it is, since it is not broken across the lines. The URL in the second item is too long to fit on the line that it starts on, and so it is broken across two lines. In that case, the URL should be on the last line on its own. In short, I just want to prevent line breaks in URLs. The bibliography entries should otherwise be justified as they normally are.

\documentclass{article}
\usepackage[paper = a4paper, vmargin = 1in]{geometry}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{indreboe1951,
AUTHOR = "Gustav Indreb\o",
TITLE = "Norsk m\aa lsoga",
YEAR = "1951",
LOCATION = "Bergen",
PUBLISHER = "John Grieg",
URL = "http://urn.nb.no/URN:NBN:no-nb_digibok_2010110808058"}
@ARTICLE{haraldsrud2015,
AUTHOR = "Andreas Droslum Haraldsrud",
TITLE = "Dansk og norsk danna talem\aa l -- ei spr\aa khistorisk jamf\o ring",
JOURNALTITLE = "Spr\aa klig Samling \AA rbok",
YEAR = "2015",
PAGES = "52--89",
VOLUME = "2014",
\end{filecontents*}
\usepackage[style = authoryear-comp]{biblatex}
\begin{document}
\nocite{*}
\printbibliography
\end{document}


Please have a look to the following code. Please see that I used some code from this question, see acepted answer .

MWE:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{indreboe1951,
AUTHOR    = {Gustav Indreb\o},
TITLE     = {Norsk m\aa lsoga},
YEAR      = {1951},
LOCATION  = {Bergen},
PUBLISHER = {John Grieg},
URL       = {http://urn.nb.no/URN:NBN:no-nb_digibok_2010110808058},
}
\end{filecontents*}

\documentclass{article}
\usepackage[%
paper = a4paper, vmargin = 1in,
showframe
]{geometry}
%\usepackage{ragged2e}
\usepackage{microtype}

\usepackage[%
style = authoryear-comp,
backend=biber,
]{biblatex}

% Following code you find in
% https://tex.stackexchange.com/questions/29802/biblatex-and-new-line-for-doi-url-and-eprint
\newbibmacro*{bbx:parunit}{%
\ifbibliography
{\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\clearlist{pageref}%
{}}

\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:doi}
{\printfield{doi}}
{}%
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}}

\renewbibmacro*{eprint}{%
\iffieldundef{eprinttype}
{\printfield{eprint}}
{\printfield[eprint:\strfield{eprinttype}]{eprint}}}

\renewbibmacro*{url+urldate}{%
\printfield{url}%
\iffieldundef{urlyear}
{}