Step 1: Launch the Phone app on your Galaxy S4, and dial in: *#0011#
Step 2: Press the Menu button followed by the Back key. Then, hit the Menu button again and select KEY INPUT. Enter 1 and press the OK button to enter ServiceMode.
Step 3: Press Menu one more time and tap back again. This will pull up the Main Menu for ServiceMode. Tap  UMTS.
Step 4: Now select DEBUG SCREEN, followed by  PHONE CONTROL.
Step 5: From the next screen, pick  NETWORK LOCK.
Step 6: You’ll get three options. Hit the one that says  PERSO SHA256 OFF.
Step 7: Now, you need to get back to Main Menu. To do this, hit the Menu button followed by the Back key. In Main Menu, now pick COMMON, and then  NV REBUILD.
Step 8: The phone will tell you that a Golden Backup exists. Tap  Restore Back-up.
Your device will now go through a series of “conditions”, where it will first freeze, then get on a black screen with Blue LED on and both capacitive buttons on, after which it will reboot automatically. The whole cycle might take a couple of minutes, so be patient. Once it powers back on, it’s network unlocked, permanently. Enjoy Folks ...