This tip explains how to change the default action assigned to the side button of iPhone. You can either use the side button to lock the screen rotation or mute your device; it's just a matter of personal preference. This option was first introduced on the iPad, but has been lacking on the iPhone until the release of iO9. So before enabling this option make sure that you read our article on how to upgrade to iOS9.
Go to Settings
> Use side switch to
and then tap to select one of the following options: Lock Rotation