Perhaps, in an attempt to diagnose the problem prematurely (and too long for a comment without visualization), here's a possible scenario causing the difference in length between the header rule and the text block: Choosing the page style before modifying the page layout dimensions.
In the minimal example below, the page style is set to fancy
(from the fancyhdr
package) before using geometry
to set the page layout.
\documentclass{article}%\usepackage{lipsum}% http://ctan.org/pkg/lipsum\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr\renewcommand{\headrulewidth}{0.4pt}%\pagestyle{fancy}\usepackage{geometry}% http://ctan.org/pkg/geometry\begin{document}\lipsum[1-20]\end{document}
Setting the page style to fancy
after loading geometry
yields