You can define WP_HOME & WP_SITEURL in wp-config.php
define('WP_HOME','http://localhost/project_folder_name');define('WP_SITEURL','http://localhost/project_folder_name');
This can also be caused by an error with the siteurl and home options in wp_options table.
siteurl
home
wp_options
Make sure the url's have a host as well, http://example.com not just example.com.
http://example.com
example.com