Praise be to Allah.
Firstly: it is mustahabb (recommended) for the Muslim to return the greeting of salaam in a manner similar to that which was said to him, or better than it.
Islamic teaching recommends that the recipient of the greeting should return the greeting in a manner similar to what was said to him, or better than it.
Allah (may He be exalted) says (interpretation of the meaning):
“And when you are greeted with a greeting, greet [in return] with one better than it or [at least] return it [in a like manner]. Indeed, Allah is ever, over all things, an Accountant”
Ibn al-‘Arabi (may Allah have mercy on him) said:
With regard to the words of Allah (may he be exalted), “greet [in return] with one better than it or [at least] return it [in a like manner]”, there are two views:
The first is that it should be better in it in character, so if he wishes you a long life, then say “Salaamun ‘alaykum”, for that is better than it, and it is in accordance with human nature and with the teachings of the monotheists.
The second is if he says to you “Salaamun alayka” then say “Wa ‘alayka as-salaam wa rahmatullah.” End quote from Ahkaam al-Qur’an (1/464-465].
Ibn Katheer (may Allah have mercy on him) said:
The words ““And when you are greeted with a greeting, greet [in return] with one better than it or [at least] return it [in a like manner]” mean: If a Muslim greets you with salaam, then return the greeting with something better than he said, or at least return the greeting in a similar manner. Adding more is recommended, and returning a similar greeting is obligatory.
End quote from Tafseer Ibn Katheer (2/368).
For more information, please see the answer to question no. 132956.
Secondly: The ruling on returning the greeting of salaam by saying “Salaam wa rahmatullah.”
Common folk say, in the country of the questioner and other countries, when returning the greeting, “Salaam wa rahmatullah,” instead of “Wa ‘alaykum as-salaam.” This is contrary to what is preferred, which is to respond with a greeting better than the initial greeting, so it is a shortcoming as it omits the definite article al- and also omits the word ‘alaykum. What should be done is to include the word ‘alaykum in the response. This is what is best, and there is no difference of scholarly opinion concerning that.
But if the one who is responding limits it to this wording, or that is widespread in some country, then it is acceptable according to the correct view, and he is not regarded as having failed to respond because of that, even if he misses out on the virtue of responding with something better than the greeting that the questioner gave him.
More than one of the scholars has stated that using the definite article al- when returning the greeting of salaam is recommended, but is not obligatory.
Ibn Muflih (may Allah have mercy on him) said in al-Aadaab ash-Shar‘iyyah (1/399):
With regard to returning the greeting, it should have the definite article, and the author of an-Nuzum regarded it as the basis principle with regard to greeting, which indicates that using the definite article is recommended, and this is clear. End quote.
Imam an-Nawawi (may Allah have mercy on him) clearly stated that it is a matter of choice whether to use the definite article or not when responding to the greeting of a Muslim, even if the initial greeting is given with the definite article.
Imam an-Nawawi (may Allah have mercy on him) said:
If the one who initiates the greeting says “salaamun ‘alaykum” or “as-salaamu ‘alaykum”,
then the one who is responding to the greeting may say in either case “Salaamun ‘alaykum,” or he may say,
“as-salaamu ‘alaykum”. Allah (may He be exalted) says: “they said, ‘Peace [salaam].’ He said, ‘Peace [salaam]’” [Hood 11:69].
Imam Abu’l-Hasan al-Waahidi, one of our companions, said: You have the choice whether to use the definite article or not.
I say: But using the alif and laam [i.e., the definite article al-] is better.
End quote from al-Adhkaar (p.219).
See something similar in Sharh al-Muhadhdhab (4/597).
For more information, see also: al-Futoohaat ar-Rabbaaniyyah by Ibn ‘Allaan (5/294-295).
The wording of the response to the greeting mentioned is acceptable, even though it is better to use the complete form when returning the greeting, based on what has been explained above.
For more information, please see the answer to question no. 128338.
And Allah knows best.