There are following below steps need to follow
[1]- Go To STORES > Configuration, redirects on configuration
[2]- Left Panel Clicked on General > Web, redirects on [Right Panel]
[3]- Once redirection on [Right Panel]
[4] -Once clicked / expanded, URL Options [Right Panel]
- Add Store Code to Urls : It is strictly recommendation , always select No. By Default Selected No. Never try to select Yes, otherwise Application will be stopped.
- Auto-redirect to Base URL : It represents Auto Redirection Website Application Base URL, normally these setting need to do .htaccess file of Website Application, but here Magento 2 provide Admin Setting to do.
- There are three type redirection
No : Once selected No, There will no Redirection in Base URL.
Yes(302 Found) : Once selected Yes(302 Found), Base URL will b redirected from http://yoursite.com To http://www.yoursite.com
Yes (301 Moved Permanently) : Once selected Yes (301 Moved Permanently), indicates Permanent redirection from Base URL to another Base URL, Search Engines that page has moved that new page can be properly indexed,
Some Common of Yes (301 Moved Permanently)
- After moving New Domain
- After Moving old site pages to new site pages , so that users can view new site pages.
[5] – Finally click on Save Config Button