Assalaamu alaykum wa rahmatullaahi wa barakaatuhu. While prostrating, do both of the hands have to have contact with the floor, with the palms flat on the floor? I read somewhere that if you do not have both your feet or both your hands on the floor, then your prayer is invalid. Sometimes, I scratch myself with one of my hands, so I do not touch the floor with that hand for a moment, is my prayer then invalid? Or if I accidentally lift my nose up and then put it back down on the floor, is my prayer still valid? If I lift one of my feet, maybe to scratch the other foot or something, is my prayer invalid?
All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad is His slave and Messenger.
Touching the ground with the palms and toes in prostration is a recommended act, not an obligation. It is also recommended for the palms of the hands to be in line with the shoulders and for the fingers to be close together, pointing towards the Qiblah (prayer direction). The Maaliki scholar Ibn Abi Zayd wrote in his book Ar-Risaalah, "It is recommended for the woman to touch the ground with her palms and face in prostration, just like it is for the man. It is recommended for him to touch the ground with his face and hands. There is no harm to prostrate on a barrier in case of severe heat or cold."
Ibn Qudaamah wrote, "It is recommended to place the two palms flat on the floor, keeping the fingers closed (no gap between them), pointing towards the Qiblah and in line with the shoulders." [Al-Mughni]
If he fails to perform the prostration in this manner and any of the seven body parts of prostration partially touch the floor or only one toe or finger touches the floor, then his prayer is still valid. The Hanbali scholar Ibn An-Najjaar said, "It is sufficient that a part of each of the seven body parts of the prostration (the face; the two hands; the two knees; and the two feet) touches the ground during the prostration..." [Muntaha Al-Iraadaat]
The same applies if the praying person places his forehead on the ground but his nose does not touch the ground or if he lifts his nose up after it had touched the ground during prostration intentionally or unintentionally; his prayer is still valid because it is recommended to let the nose touch the ground in prostration, not obligatory, according to the view of the majority of scholars. The Kuwaiti Encyclopedia of Islamic Jurisprudence reads, "The majority of the scholars, who are the Maalikis, Shaafiʻis, Abu Yoosuf and Muhammad, students of Imaam Abu Haneefah, held that it is not obligatory that the nose touches the ground along with the forehead during prostration... This is also one of the reported views narrated on the authority of Imaam Ahmad."
You remarked, "Sometimes, I scratch myself with one of my hands." If you mean that you place only the palm of one hand on the floor while prostrating and lift the other, then you should know that this is contrary to the Sunnah and a violation of the proper manner of performing the prayer. It is an act of the Sunnah that the seven body parts of the prostration touch the ground during prostration. Some scholars even held that it is obligatory. However, it does not invalidate the prayer that any of these seven body parts does not touch the ground during prostration based on the view that it is an act of Sunnah and not obligatory. Nevertheless, according to the other view (that it is obligatory), it invalidates the prayer if the praying person intentionally does not prostrate on them.
Ibn Qudaamah wrote, "If he fails to prostrate on one of these parts, then his prayer is invalid according to the scholars who held that it is obligatory (to prostrate on these parts)."
The preponderant view is that of the majority of the scholars: the prayer of the person who prostrates on his face only apart from the rest of the parts is not invalidated, because prostration is achieved by prostrating on the forehead.
Hence, everything that you mentioned of lifting the nose, hands, or feet during prostration does not invalidate the prayer. However, the perfect manner according to the Sunnah of the Prophet is that all seven body parts touch the ground during prostration.
Allaah knows best.
You can search for fatwa through many choices