
547 Pa. 649 (1997)
692 A.2d 1067
Dominic FAJOHN, Appellant
v.
COMMONWEALTH of Pennsylvania, DEPARTMENT OF CORRECTIONS, Appellee.
Supreme Court of Pennsylvania.
Submitted December 9, 1996.
Decided April 22, 1997.
*650 Dominic Fajohn, Pro Se.
Clifford D. Swift, Lancaster, for Dept. of Corrections.
Before FLAHERTY, C.J., and ZAPPALA, CAPPY, CASTILLE, NIGRO and NEWMAN, JJ.

OPINION OF THE COURT
FLAHERTY, Chief Justice.
On September 30, 1994 Dominic Fajohn was sentenced by the Butler County Court of Common Pleas to fourteen and a half months to twenty-nine months for crimes committed at Nos. 192-94 and 194-94. While incarcerated on this sentence, on April 10, 1995, Fajohn was sentenced at No. 1351-94, 1262-94, 1373-94, 1379-94 and 136-95 pursuant to a negotiated plea agreement. The sentence was eighteen months to three years. Fajohn asserts that at his request, the court granted him 190 days credit for the period October 3, 1994 until April 10, 1995 on one of the three sentences, the sentence imposed at 1351-94.
The Department of Corrections declined to apply credit for the 190 days on the grounds that it was prevented from doing so by Pa.R.Crim.P. 1406(c), which provides:
When at the time sentence is imposed, the defendant is imprisoned under a sentence imposed for any other offense or offenses, the instant sentence which the judge is imposing shall be deemed to commence from the date of imposition thereof unless the judge states that it shall commence from the date of expiration of such other sentence or sentences.
*651 Thus, the Department of Corrections took the position that it is precluded from applying credit for the period October 3, 1994 until April 10, 1995, for Fajohn was imprisoned for other offenses when the April 10 sentence was imposed.
Fajohn brought an action in the Commonwealth Court in mandamus to compel the department of corrections to apply the 190 day credit. Commonwealth Court sustained the Commonwealth's preliminary objections in the nature of a demurrer, and Fajohn filed this direct appeal.
In Doxsey v. Commonwealth, 674 A.2d 1173, (Pa.Cmwlth. 1996), the petitioner also brought an action in mandamus seeking to have his pre-sentence confinement credited toward his sentence. Commonwealth Court sustained the Commonwealth's demurrer, relying on Pa.R.Crim.P. 1406(c):
It is clear that under this rule a sentencing judge cannot direct that a sentence commence on a date prior to the date of sentencing when the defendant is serving time on an unrelated charge. . . . Respondent relies on this rule in refusing to honor the sentencing judge's order. The question we must decide is whether, when a sentencing judge issues a clearly illegal order, mandamus will lie against the Department of Corrections to compel it to honor that order. We hold that it will not.
* * *
Because rule 1406(c) makes it clear that the judge was precluded from ordering and, consequently, that respondent is precluded from applying, credit for the period of imprisonment for a second or subsequent conviction if the individual is already in prison under a sentence imposed for other offenses, mandamus will not lie against respondent to compel it to abide by the sentencing order.
This is not to say that petitioner has no remedy. In a situation where, because a sentence is illegal, a prisoner does not receive the benefit of his plea bargain, the proper avenue would appear to be to seek relief in the sentencing court. While the court cannot declare the vehicle for obtaining *652 such relief, what is clear is that the remedy is not one in mandamus against the Department of Corrections to compel it to honor an illegal order.
674 A.2d at 1175.
In this case as in Doxsey, mandamus is not available to compel the relief petitioner seeks. Rather, the proper avenue for petitioner's request is an application for re-sentencing in which Fajohn alleges that he has not received the benefit of his plea bargain, coupled with a request that the sentencing court reduce his sentence to the extent of 190 days so that he may receive the benefit of the plea bargain.[1]
Order of the Commonwealth Court is affirmed.
NOTES
[1]  Because Pa.R.Crim.P. 1410 allows the trial court to correct its orders before an appeal is taken or upon remand by an appellate court, and because 42 Pa.C.S. § 5505 limits that power to 30 days after the entry of the order, Fajohn's access to the trial court appears to be foreclosed. His appropriate course of action at this point would be to file a motion for modification of sentence nunc pro tunc in the court of common pleas, asserting that the sentence as recorded did not reflect the bargain or the intent of the court, a fact which did not become apparent until beyond the thirty day appeal period.
