If you have not removed your index.php from your application using the .htaccess file, well, this is another ball game in itself. But you can do the following:
Set the default controller , not the welcome file, and if you want the welcome file to be your default, use the link this way
http://localhost/myapp/index.php/login
Remember that this method only works when the index.php file has not been deleted using the .htaccess file.
Also open apllication/config/config.php and use this code for baseurl
$config['base_url'] = 'http://localhost/myapp';
This should always do the trick.
source share