pagestyle apply to first page of bibliography

I have a problem centering the page number only on the FIRST page of Bibliography. Following is my code:

\documentclass[12pt,a4paper,twoside]{report} % "openright" starts each chapter on an odd-page, remove if not needed
\usepackage[top=2.54 cm, bottom=2.54 cm, left=2.54 cm, right=2.54 cm]{geometry}

\usepackage{fancyhdr}
\usepackage{apacite}

% define two styles : prelim and main
\fancypagestyle{prelim}{
\fancyhf{} %clear all headers and footers fields
\cfoot{\thepage} %prints the page number on the center side of the footer
}

\fancypagestyle{main}{
\fancyhf{} %clear all headers and footers fields
\chead{\thepage} %prints the page number on the center side of the header
}

\fancypagestyle{plain}{\pagestyle{prelim}}

\begin{document}

\tableofcontents
\cleardoublepage
\listoftables % if necessary
\clearpage
\listoffigures % if necessary
\newpage

% apply main style for chapter and reference
\pagestyle{main}
\pagenumbering{arabic}
\include{chp1}
\newpage

\bibliographystyle{apacite}
\bibliography{mybib} % this is mybib

\end{document}


% chp1.txt is

\chapter{Introduction}
\thispagestyle{main}
Text for Introduction.

• I can't compile your code as is, obviously. When I hacked it in order to make it usable, it worked fine. The page number is in the centre of the footer, just as you've defined. – cfr Feb 15 '16 at 3:33
• Thanks. For table of contents, I want it to be in the center of the footer, but for other I want it to be on the center of the header. It works for all, but the first page of the Bibliography. I can't add Bibliography here so there was an error. But, even with that you can still see that page number is in the bottom for the first page, while I want it at the top. – Metrics Feb 15 '16 at 14:17

Adding \def\thispagestyle#1{} solves the problem

\newpage
\bibliographystyle{apacite}
\bibliography{mybib} % this is mybib

• And now \thispagestyle will no longer work for the rest of your document. – cfr Feb 15 '16 at 20:23
• Thanks @cfr. It's fine for my problem. But, it may not be a good solution for other problems. – Metrics Feb 16 '16 at 14:00
• Just redefine the plain style again before the bibliography. – cfr Feb 16 '16 at 14:12
• Please feel free to update the answer. – Metrics Feb 16 '16 at 15:09