I need some help, my websites are showing the key after the url. So i thought it is still in developer mode and need to be turned into production mode.

I checked the magento file in folder bin, but can't find a thing. Please check:

#!/usr/bin/env php
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
if (PHP_SAPI !== 'cli') {
echo 'bin/magento must be run as a CLI application';
exit(1);
}
try {
require __DIR__ . '/../app/bootstrap.php';
} catch (\Exception $e) {
echo 'Autoload error: ' . $e->getMessage();
exit(1);
}
try {
$handler = new \Magento\Framework\App\ErrorHandler();
set_error_handler([$handler, 'handler']);
$application = new Magento\Framework\Console\Cli('Magento CLI');
$application->run();
} catch (\Exception $e) {
while ($e) {
    echo $e->getMessage();
    echo $e->getTraceAsString();
    echo "\n\n";
    $e = $e->getPrevious();
}
exit(Cli::RETURN_FAILURE);
 }
  • What do you mean by "showing the key after the url"? – Ryan Hoerr Oct 17 at 17:29
up vote 1 down vote accepted

You have tried to check a wrong file. The Magento mode is set in the app/etc/env.php file.

There are two ways to set the production mode for the website:

Method 1: Open the app/etc/env.php file and change:

'MAGE_MODE' => 'developer',

to

'MAGE_MODE' => 'production',

Method 2: Open the terminal and change directory to the document root of your Magento folder. Then run the following command:

php bin/magento deploy:mode:set production
  • Thanks, I see that it is in production mode – Anushka27 Oct 21 at 10:24

It's normal that bin/magento is empty. You get an error when you run the deploy:mode:set command?

Switch to production mode:

rm -rf /website-root/generated/metadata/* /website-root/generated/code/*

then

php bin/magento deploy:mode:set production

Hide URL key:

  php bin/magento config:set admin/security/use_form_key 0
  • I there a file where i can hide the URL key? because i don't know where and how to run the command. – Anushka27 Oct 21 at 10:26

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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