301 redirect in .htaccess

I have searched the forums here and have tried various coding people have provided but none of it seems to work. Could someone maybe post a step by step guide on how to do this including code, where to put the code and server settings to allow it?