I'm trying to install WordPress on my localhost with composer. When I go to localhost I get redirected to localhost/wp-admin/setup-config.php. Instead of getting the install I'm getting the error The requested URL /wp-admin/setup-config.php was not found on this server. When i go to localhost/wordpress/wp-admin/setup-config.php it works? What am I doing wrong?

This is my directory tree :

-- .git
-- .gitignore
-- composer.json
-- composer.lock
-- vendor

-- htdocs
----- index.php
----- wp-content
----- wordpress
----- wp-config

In the htdocs/index.php I have this

define('WP_USE_THEMES', true);
require( dirname ( __FILE__ ) . '/wordpress/wp-blog-header.php' );

And in my htdocs/wp-config I edited this :

define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wordpress');
define('WP_HOME',    'http://' . $_SERVER['SERVER_NAME']);
define('WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content');
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp-content');
  • What do you have in wp-config.php (other than passwords etc.) & .htaccess (apache) or NginX configuration?
    – Fayaz
    Feb 6, 2017 at 1:16
  • @Fayaz i've updated the question!
    – twoam
    Feb 6, 2017 at 16:52

1 Answer 1


Your WordPress is installed under the localhost/wordpress/ instead of localhost/. If you are running your WordPress for the first time, point your url to localhost/wordpress/wp-admin/install.php so that the correct path can be setup by the WordPress.

  • Where do I change that?
    – twoam
    Feb 6, 2017 at 16:46
  • It is perfectly fine to run your wordpress at localhost/wordpress/ as is, but if you prefer to run it from localhost/, move all the files in the wordpress directory to hotdocs and change the WP_SITEURL setting to the same as WP_HOME setting in the wp-config.php.
    – hcheung
    Feb 7, 2017 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.