I have tried to install magento 2.4 using below commands

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition m24

bin/magento setup:install --backend-frontname="admin" \
--db-host="localhost" \
--db-name="m24" \
--db-user="root" \
--db-password="password" \
--language="en_US" \
--currency="GBP" \
--timezone="Europe/London" \
--use-rewrites=1 \
--use-secure=0 \
--base-url="http://localhost/magento/m24/" \
--base-url-secure="https://localhost/magento/m24/" \
--admin-user=admin \
--admin-password=admin@111 \
--admin-email=any@any.com \
--admin-firstname=admin \
--admin-lastname=admin \

It installed but when i visit http://localhost/magento/m24/ it shows 404 not found On http://localhost/magento/m24/pub/ it redirects to homepage but no image & css fetch as its all 404.

Any way to make it work ?

  • Did you created separate conf file? Or edit in 000-default.conf file? Jul 24, 2021 at 16:34
  • It worked, as per your article for magento 2.4 pub, but now other magento setup are not accessible. localhost redirects to the site (example.com) as per the article. Jul 24, 2021 at 16:54
  • I followed same steps mentioned in your article rohanhapani.com/… Jul 24, 2021 at 17:00
  • If you will create virtual host then it will be working on multiple instance. I already tried. Jul 24, 2021 at 17:03
  • did that worked ? instead of example.com i used magento24.com it worked but then the other magento exisiting setup are not working. @RohanHapani it would be helpfull if you add or update answer or your article to create multiple instance in local. Like example.com Jul 26, 2021 at 5:27

1 Answer 1


Actually when you setup mangento, you need to point magento to pub directory.

Now that you are using localhost and you haven't used virtual host, you need to open your project with http://localhost/magento/m24/pub/

For images and CSS, access your database and you need to update table core_config_data
execute following commands:

UPDATE core_config_data SET `value`='http://localhost/magento/m24/pub/' WHERE path='web/unsecure/base_url';
UPDATE core_config_data SET `value`='http://localhost/magento/m24/pub/' WHERE path='web/secure/base_url';
UPDATE core_config_data SET `value`='http://localhost/magento/m24/pub/media/' WHERE path='web/unsecure/base_media_url';
UPDATE core_config_data SET `value`='http://localhost/magento/m24/pub/media/' WHERE path='web/secure/base_media_url';

Flush cache at the end

Hope this will resolve the issue

  • I had followed this article rohanhapani.com/… but now localhost redirect to the example.com how to manage multiple magento setup with this ? Jul 24, 2021 at 16:12
  • for local, instead of example.com use .local domains, like m24.local. For all other magento websites you also need to configure virtual host. After this setup your localhost wont work Jul 25, 2021 at 3:44
  • Yes, localhoist not working it redirects to single magento setup. Jul 26, 2021 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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