Using texlive 2013. The following MWE compiles fine with pdflatex, but gives the error:
./foo.aux) [1]
Chapter 1.
! LaTeX Error: \theHchapter undefined.
when I run it using the command:
htlatex foo.tex
Here is the file
\documentclass[12pt]{report}
\usepackage[toc,page]{appendix}
\usepackage{hyperref}
\begin{document}
\chapter{first}
some text
\begin{appendices}
\chapter{some chapter}
some text again
\end{appendices}
\end{document}
I really do not have to use the appendix package if that is the problem, I just wanted a way to obtain an Appendix title, before each chapter I add as an appendix. Without this package, I do not get this Appendix title on its own.
>htlatex foo.tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
restricted \write18 enabled.
entering extended mode
Update
Putting the new file appendix.4ht (thanks to michal.h21 answer below) in $TEXMFHOME/tex/latex/tex4ht worked. Strange why /usr/local/texlive/2013/texmf-dist/tex/generic/tex4ht does not work since that is where all the other .4ht files are?
But there are still issues with toc.
The table of contents links is not formatted correctly. Clicking on the appendix link from toc opens a web page that also contains the last section from the main body inside it. And clicking on the last section of the body opens a page that contains the appendix in it. So it seems that appendix is treated as part of the last section that appears in the body, instead of being a separate section on its own web page.
Here is a MWE example:
\documentclass{article}
\usepackage[toc,page]{appendix}
\usepackage{hyperref}
\begin{document}
\author{me}
\title{title}
\date{\today}
\maketitle
\tableofcontents
\section{first}
some text
\section{two}
some text in section 2
\begin{appendices}
\section{somesection inside appendices}
some text again
\end{appendices}
\end{document}
Now compiled with
htlatex foo.tex "htm,2" %now split 2 option to see the problem

update: To answer @egreg on using mktexlsr, I did now use that. As root, but still htlatex does not see the file appendix.4ht when this file is in /usr/local/texlive/2013/texmf-dist/tex/generic/tex4ht with all the other .4ht files. It only works when this file is in local $TEXMFHOME/tex/latex/tex4ht which is really strange. Here is screen shot:

I did this 2 times, just in case. Also tried it on the MWE posted above, with same error. Do I need to do any other setup changes? or did I copy the file to the wrong folder? I am using TL 2013 on Linux xmint.
/usr/local/texlive/2013/texmf-dist/tex/generic/tex4htyou should also runmktexlsr(ortexhashwhich is the same). But don't add files there. – egreg Oct 24 '13 at 15:00texconfig rehashwhich according to http://tex.stackexchange.com/questions/120150/is-there-a-difference-between-texconfig-rehash-and-mktexlsr it says:texconfig rehash calls mktexlsrbut I will try again withmktexlsrand see if that makes it work.... will need a minute – Nasser Oct 24 '13 at 15:06texconfigis kept just for backwards compatibility. Did you acquire superuser privileges before running it? – egreg Oct 24 '13 at 15:10