How to Configure Robots.txt in Magento 2?

As you know, configuring robot.txt is important to any online store that is working on a site’s SEO.

You can configure the option by following below path in Magento 2.x admin.

Go to Stores -> Configuration -> General (Left side) -> Design (section) -> Search Engine Robots -> Default Robots (Select)-> Select

  • INDEX, FOLLOW Instructs web crawlers to index the site and to check back later for changes.
  • NOINDEX, FOLLOW Instructs web crawlers to avoid indexing the site, but to check back later or changes.
  • INDEX, NOFOLLOW Instructs web crawlers to index the site once, but to not check back later for changes.
  • NOINDEX, NOFOLLOW Instructs web crawlers to avoid indexing the site, and to not check back later for changes.

Now In order to set Custom Instructions.

For e.g:

Allows Full Access

Disallows Access to All Folders

Default Instructions

When complete, click Save Config.

If you have any query related to configure Robots.txt file then please write in comments.

Enjoy Magento 2!

Admin design configuration does not save in Magento 2.1.x

Solution

Find the file \vendor\magento\module-email\Model\AbstractTemplate.php and on line number 672 replace the if condition if ($storeId) with if ($storeId !== false)

Explanation

When you are saving the Global Configuration for the Store, you can see in the url that the current scope id is 0 (admin/theme/design_config/edit/scope/default/scope_id/0/) This is important.

Now, when you save the configuration, Magento will try to validate the Header and Footer templates whether you change them or not, using the class Magento\Theme\Model\Design\Config. While doing so, Magento instantiates an object of class \Magento\Email\Model\Template which actually extends the class \Magento\Email\Model\AbstractTemplate.

Using this template class, Magento tries to emulate the template for the current scope. This is where the issue lies. You can find the code for this at line 670 of \Magento\Email\Model\AbstractTemplate.

Since the scope_id for the Global scope is 0 (Note: scope_id is being passed as storeId here), false is returned and Magento starts to look into adminhtml for the templates. Now all you have to do is change the if condition from if ($storeId) to if ($storeId !== false) and you will be able to save the configuration.

Ref: http://magento.stackexchange.com/questions/125994/admin-design-configuration-does-not-save-in-magento-2-1-0

How to reset admin password in Magento 2?

In order to reset the admin password from phpmyadmin in Magento 2, please follow below simple steps.

1) Go to phpMyAdmin
2) Open table admin_user
3) Run the following sql query

Here, NewPassword -> Replace it with your password.

Thats it. Enjoy Magento 2!! Enjoy Magewallet!!!

How to change default sort order from ascending to descending in Magento 2?

In order to change default sort order from ascending to descending in Magento 2, first you need to copy vendor/magento/module-catalog/view/frontend/layout/catalog_category_view.xml to app/design/frontend/{{Vender_Namespace}}/{{Theme_Name}}/Magento_Catalog/layout/catalog_category_view.xml into your theme.

Now copy below code to your new xml file.

Thats it. Enjoy Magento 2!! Enjoy Magewallet!!!

Ref: http://magento.stackexchange.com/questions/119642/magento2-default-to-sort-by-price-descending-not-ascending

How to get extension version in Magento 2?

In order to retrieve version of any extension/module in Magento 2, you can use following code snippet.

Here, Wallet is vendor name and Version is module name.

Enjoy cool stuff! Enjoy Magento 2!! Enjoy Magewallet!!!