Both sentences are correct I need to find out the rule for TO and FOR when used with I.O.
The rules of grammar are for the purpose of ensuring clarity of meaning of the communication. 'Meaning' comes from the words, and the rules of how we put them together make sure this meaning is not obscured.
The basic meaning of words is not determined by a 'rule'. In sentences, we may have Direct and Indirect Objects; but it is not the fact that words such as 'to' and 'for' occur in these constructions, but the meaning of those prepositions in the context of what is being said.
'to' expresses motion in the direction of a particular location/person/thing
So-"I passed the salt to her" means the salt is being moved across the table towards her, handed to her.
one of the meanings of 'for' is : 'on behalf of or to the benefit of someone or something'
"I passed the salt for her." Here, the meaning could be ambiguous, since we have an isolated sentence, and no context.
'for' could have the meaning 'on behalf of', so the sentence would mean, somebody asked her to pass them the salt, but you did it instead - you did it for her.
That you passed the salt to her 'for her benefit' that is, so she could use it. "I passed the salt for her (to use/to season her food with)."
I opened the door to her incorrect
I opened the door for her correct
No. Both are correct. The meanings are different.
If I said, "My door is always open to you." it means that you are always welcome in my house. Here, 'to' has the meaning and purpose in the sentence of identifying the person or thing affected by my action. Equally, if I lived in a crime-ridden city, I might not open my door to strangers at night.
In your sentence, what say a father has previously disowned his daughter, who now turns up, illegitimate baby in arms, homeless, knocking at her father's door. Will he open the door to her, or will his Victorian heart remain cold as steel? Your sentence is his answer!
"I opened the door for her."
Here, the meaning is, 'I opened the door for her benefit, so she could walk through the doorway, so she didn't have to open it herself.'