6503 - Right to apply for writ.

     § 6503.  Right to apply for writ.        (a)  General rule.--Except as provided in subsection (b), an     application for habeas corpus to inquire into the cause of     detention may be brought by or on behalf of any person     restrained of his liberty within this Commonwealth under any     pretense whatsoever.        (b)  Exception.--Where a person is restrained by virtue of     sentence after conviction for a criminal offense, the writ of     habeas corpus shall not be available if a remedy may be had by     post-conviction hearing proceedings authorized by law.