how about this circuit?
It's good but it's not really needed in industrial PLCs.
The circuit will work the same but what you have done is put a flyback diode over the relay coil. It will dissipate the current surge that the coil produces when you turn off the relay. So it protects the digital output on the PLC.
A flyback diode is standard practice in electronic design but not in industrial PLCs so I assume that the outputs of a PLC can handle things like this.