So, I am trying to upgrade my magento from 2.3.6 to 2.4.

I have updated my PHP from 7.3 to 7.4 for that. I am able to run composer install, composer update and all other magento commands without any error. I have checked my database as well. Everything looks fine for me. But when I go to the url I get "The requested URL not found on this server."

No matter how many instances I have created from scratch. I still get the same error. If anyone can help me it will be really helpful.

enter image description here

2 Answers 2


In your database core_config_data table change the both url

web/unsecure/base_url ->

web/secure/base_url ->

Run the following command :-

  1. bin/magento se:up
  2. bin/magento s:d:c
  3. bin/magento s:s:d -f
  4. chmod -R 777 var/ generated/
  • Thank you for the solution. It solved my problem. Oct 1, 2021 at 20:24

Confirm Document Root (Nginx/Apache)

I'm assuming you have this covered, but maybe verify that the document root is pointed to the correct location. Best practice is to serve the site from the pub folder of Magento.

Verify .htaccess files present (Apache)

The first clue I see is that you're getting a non-Magento 404 page.

Depending on where your document root is set to serve the site from, there should be an .htaccess or pub/.htaccess file present. It redirects all requests to the index.php entry point of Magento and would give you a Magento 404 page when trying to hit the /xyz url when it doesn't match any Magento routes.

If using Apache, I would confirm that those files are present. They come bundled with Magento.

Ensure URL Rewrites are Enabled

Do you have "use url rewrites" enabled from the admin? If you can't get to the admin to check/enable it you could do it in the core_config_data table or via bin/magento:

php bin/magento config:set web/seo/use_rewrites 1

  • I checked my pub folder and I have .htaccess file inside my pub folder. But when I ran the command "php bin/magento config:set web/seo/use_rewrites 1" it gave me error "The value you set has already been locked. To change the value, use the --lock-env option." . Any suggestions? May 5, 2021 at 17:43
  • It's hard to say without being able to troubleshoot it directly. It looks like from that error that you already have web/seo/use_rewrites locked in app/etc/env.php. You could confirm it's value there as being 1, but I'm not convinced that's your problem as it doesn't look like the request even hits Magento.
    – sdaugherty
    May 5, 2021 at 17:48

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.