I tried this question then after i cannot access from localhost.is there any solution so that i can use both ways  
Incorrect access detected, this server may be accessed only through http://localhost/moodle address, sorry. Please notify server administrator.
networking;moodle
If you follow the answer described in the other section, you can still access it FROM the local host (same machine), but you have to you the syntax: http://192.168.1.50/moodle/instead of  http://localhost/moodle/