The memoir
class provides its own methods for defining headers. See Chapter 7 "Pagination and headers" in the manual. Below is your MWE except that I have added memoir
code for your headers at the end of your preamble.
%chapmempageprob.tex SE 612428
\documentclass[a4paper, 12pt, oneside]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{indentfirst}
\usepackage{fancyhdr} %fancy header and footer
\usepackage[colorlinks=true, linkcolor=black]{hyperref}
\usepackage{afterpage} % page break without beeing counted
\usepackage{comment}
%%%%%%%%%%%%%%% Layout
\chapterstyle{article} %chapter title in bold, lefrangged, no flourish
%Header and foot
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyfoot{}
\fancyhf{}
\lhead[\thepage]{\textit{\leftmark}}
\rhead[\nouppercase{\rightmark}]{\thepage}
\makeatletter
\fancypagestyle{plain}{%header chapter first page
%%\if@mainmatter
\renewcommand{\headrulewidth}{0pt} %no header
\fancyfoot{} %no foot
\fancyhf{}
%\lhead[\thepage]{\textit{\leftmark}}
%\rhead[\nouppercase{\rightmark}]{\thepage}
}
\makeatother
%%%%%%%%%%%%%%%% newcommand
\newcommand{\knc}[1]{\textit{#1}}
\newcommand{\kpage}[1]{%
\newpage
\addtocounter{page}{-1}
\thispagestyle{empty}
\vspace{\fill}
\begin{flushright}
\vspace{85pt}
\vspace*{\fill}
\HUGE{\textbf{\textit{#1}}}
\vspace*{2cm}
\end{flushright}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% initial memoir's header code
\makepagestyle{frontm} % for the frontmatter (and elsewhere if necessary
\makeevenhead{frontm}{\thepage}{}{} % even page number top left
\makeoddhead{frontm}{}{}{\thepage} % odd page number top right
\aliaspagestyle{chapter}{frontm} % use frontm as the page style for chapters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%% begin doc
\begin{document}
\frontmatter
\pagestyle{frontm}
\chapter*{}%%% abstract
Fisrt chapter page (frontmatter) - should have a roman page number on the right corner of the header, with no line beneath
\clearpage
Secong page (frontmatter) - I'm trying to get rid of the line from fancyhd, but not the page number
\mainmatter
\kpage{Introduction}
\chapter{Introduction}
First chapter page (mainmatter) - should remain as it is
\clearpage
Second page - likewise
\backmatter
\end{document}
Note that in memoir
a chapter's first page is set with the chapter
page style which is initially set to the plain
pagestyle.
I hope that I have understood your question correctly.
EDIT
Following your comment I am posting a revised answer which, I hope, does what you are after. The revisions pertain to the memoir
page styles and how they are used in the document after \frontmatter
and \mainmatter
. I also added some text to give some more pages.
% chapmempageprob.tex SE 612428
\documentclass[a4paper, 12pt, oneside]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{indentfirst}
\usepackage{fancyhdr} %fancy header and footer
\usepackage[colorlinks=true, linkcolor=black]{hyperref}
\usepackage{afterpage} % page break without beeing counted
%%%%%%%%%%%%%%% Layout
\chapterstyle{article} %chapter title in bold, lefrangged, no flourish
%Header and foot
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyfoot{}
\fancyhf{}
\lhead[\thepage]{\textit{\leftmark}}
\rhead[\nouppercase{\rightmark}]{\thepage}
\makeatletter
\fancypagestyle{plain}{%header chapter first page
%%\if@mainmatter
\renewcommand{\headrulewidth}{0pt} %no header
\fancyfoot{} %no foot
\fancyhf{}
%\lhead[\thepage]{\textit{\leftmark}}
%\rhead[\nouppercase{\rightmark}]{\thepage}
}
\makeatother
%%%%%%%%%%%%%%%% newcommand
\newcommand{\knc}[1]{\textit{#1}}
\newcommand{\kpage}[1]{%
\newpage
\addtocounter{page}{-1}
\thispagestyle{empty}
\vspace{\fill}
\begin{flushright}
\vspace{85pt}
\vspace*{\fill}
\HUGE{\textbf{\textit{#1}}}
\vspace*{2cm}
\end{flushright}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%memoir's header code
\makepagestyle{frontm} % for the frontmatter (and elsewhere if necessary
\makeevenhead{frontm}{\thepage}{}{} % even page number top left
\makeoddhead{frontm}{}{}{\thepage} % odd page number top right
\makepagestyle{mainm} % for the mainmatter (and elsewhere if necessary}
\makeoddhead{mainm}{\itshape\leftmark}{}{\thepage}
\makeheadrule{mainm}{\textwidth}{0.4pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{lipsum}
%%%%%%%%%%%%%%%% begin doc
\begin{document}
\frontmatter
\pagestyle{frontm} % use frontm page style for all non-chapter pages
\aliaspagestyle{chapter}{frontm} % use frontm as the page style for chapters
\chapter*{}%%% abstract
Fisrt chapter page (frontmatter) - should have a roman page number on the right corner of the header, with no line beneath
\clearpage
Secong page (frontmatter) - I'm trying to get rid of the line from fancyhd, but not the page number.
\lipsum[1-5]
\mainmatter
\pagestyle{mainm} % use mainm pagestyle for all pages, except
\aliaspagestyle{chapter}{empty} % use empty as the page style for chapters
\kpage{Introduction}
\chapter{Introduction}
First chapter page (mainmatter) - should remain as it is
\clearpage
Second page - likewise
\lipsum[1-5]
\backmatter
\end{document}