How to remove header from frontmatter

I have a header created with fancyhdr. It repeats on all the pages including Table of Contents and Preface sections. I tried to use \thispagestyle{empty} but it only works on the first page while I need to clear it in the frontmatter

\documentclass[11pt]{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\makeatletter
\vskip 2pt% 2pt between lines
\hrule\@height.5pt\@width\headwidth% lower line with .5pt line width
\vskip-1.5pt}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\thispagestyle{empty}
\frontmatter

\tableofcontents
\chapter{Preface}
\lipsum
\lipsum
\mainmatter
\chapter{Ch1}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\lipsum
\section{test}
\chapter{ch2}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}

\end {document}

• Do you really want empty style or only roman page numbers, without rules? Jun 7 '16 at 11:42
• @Bernard I am still not sure about the standard, what if I want to remove the chapter title and numbering from the header, while keeping the lines... Jun 7 '16 at 11:52

change this one

\thispagestyle{empty}


to

\pagestyle{empty}


and insert \pagestyle{fancy} here

\mainmatter
\chapter{Ch1}


It will looks now like

\mainmatter
\pagestyle{fancy}
\chapter{Ch1}


Is this what you'want? In front matter, there's only chapter title (Contents/Preface), first chapter pages and white pages have empty style (for the whole document). I added the twoside option, and used the emptypage and xpatche packages to achieve that.

\documentclass[11pt, twoside]{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{xpatch, emptypage}%
\pagestyle{fancy}
\fancyhf{}

\makeatletter
\vskip 2pt% 2pt between lines
\hrule\@height.5pt\@width\headwidth% lower line with .5pt line width
\vskip-1.5pt}}
\makeatother

%%
\xpatchcmd{\chapter}{%
\thispagestyle{plain}}{%
\thispagestyle{empty}}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\frontmatter
\tableofcontents
\chapter*{Preface}
\markboth{Preface}{Preface}
\lipsum
\lipsum[1-4]
\mainmatter
\pagestyle{fancy}
\chapter{Ch1}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\lipsum
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}

\chapter{ch2}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\lipsum
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}

\end {document}