Hello Magento Folks,
Let’s say you have successfully installed and has started using the Magento Ecommerce platform. But before you proceed to add products and taking up orders or do any things else in your store, you need to setup the general configuration in your Magento store.
Today we have come up with the Ultimate Guide to walk you through how to setup the general configuration in Magento 2. Below tutorial has some advance options to configure your Magento 2 store.
URL options
Add store codes to URL:
When you have multi-store or multi-website setup for the globalization of your Ecommerce store, you must be looking for the URLs that should be country-specific, right?
For example, domain.com/en for USA/UK or domain.com/in for India or domain.com/fr for French.
You already know that you will need to setup the multi-website or multi-store view to set up for taking your business worldwide. We have already written a blog on how to do that, and you can check that out here.
Moving forward, now, if you want to that store code in the URL, you need to look for below settings and enable it.
Go to Store – Configuration – URL options – Add store code to URL – Yes
Keeping or removing www in URL is important while doing organic SEO. For example, you have the website set up with www in the domain, and if someone types URL without www, then you want them to be redirected to your URL with www. So, it’s recommended to have 302 or 301 redirects, so search engines like google during crawling and indexing don’t think its duplicate or something.
To enable this setting Go to Store – Configuration – URL options – Auto-redirect to Base URL – Yes
When you are working with Magento 2, many times, you may need to change the URLs of products or CMS pages, etc. that are already live and crawled by Google for ranking.
Now, as per SEO perspective, if you are changing the URL of the product or any page of your Ecommerce store, make sure you redirect your old URL to the new URL to keep the SEO rankings the same as it was before. If you don’t do this, Google will consider it as a new product and will start ranking it as a new one.
For detailed URL rewrite information, visit this blog.
For now, we need to keep this setting as YES
Go to Store – Configuration – Search Engine Optimization – Use Web Server Rewrites – YES
Base URLs
You will see your website base URL here, URL, which you have configured while installing Magento.
Base Link URL: It should be the same as the base URL.
Base URL for Static View Files: This will be blank as static view files will be taken from Magento root.
Base URL for User Media Files: Same as above.
Note: Any of the fields allow fully qualified URLs that end with ‘/’ (slash) e.g., http://example.com/magento/
Base URLs (Secure)
Other settings are as above explained.
Use Secure URLs on Storefront: If you are using SSL to make your website https, then you will keep this YES, so Magento can take request all the frontend URLs with https.
Read more: How to install SSL in Magento 2
Use Secure URLs in Admin: same as above.
Offloader header
There is no difference. The default offloader header in Magento 2 is X-Forwarded-Proto, which matches the de facto standard.
SSL_OFFLOADED, on the other hand, was the default offloader header in Magento 1, and also used by Nexcess Turpentine, the popular Varnish extension for Magento 1.
Basically, you can call the header however you want, you just have to make sure that your SSL terminator sends it. If you are not sure, X-Forwarded-Proto is probably the right value.
Default Pages
Default web URL: This should be CMS as it is
CMS Home Page: The homepage should be by default selected. I believe everyone needs this only. If you have designed a new CMS (homepage) page, then you need to select the homepage here.
Also, if you have multi-website wise different homepages, then you will have to select respective store views or websites and then select the homepage for it. FYI, you just need to uncheck Use System Value to change the selected page.
Default No-route URL: This URL generally is for the 404-error page.
CMS No Route Page: Select the 404 pages you want to set by website view or store view or global configuration.
CMS No Cookie Page: Set the page where the user should be redirected if its browser has not enabled the cookie. This page should have the description regarding where you should enable the cookie in your browser to access the website.
Show Breadcrumbs for CMS Pages: Select YES to display breadcrumbs on CMS Page.
To know what is Breadcrumbs and Why it is helpful for SEO, read this blog.
Default Layouts
Before understanding this setting, you need to understand what’s 1 column, 2 columns with left bar, 2 columns with right bar, and 3 columns layout. To know more, read this blog.
You can select the default page layouts for Products, Category, and Default Page. So, when you need to customize the layouts, you need to go to a specific layout file.
Default Cookie Settings
Cookie Lifetime: Enter the Cookie Lifetime value in seconds. This means your website will save the cookie in the user’s browser for these many seconds.
To know what is cookie and how it is useful for your website, read this blog.
Cookie Path: If you want to make cookies available to other folders, enter the Cookie Path. To make the cookies available anywhere in the site, enter a forward slash.
Cookie Domain: To make the cookies available to a subdomain, enter the subdomain name in the Cookie Domain field. (subdomain.yourdomain.com) To make cookies available to all subdomains, enter the domain name preceded by a period. (.yourdomain.com)
Use HTTP Only: To prevent scripting languages such as JavaScript from gaining access to cookies, make sure that HTTP Only is set to “Yes.”
Cookie Restriction Mode: Set Cookie Restriction Mode to “Yes.” This will help users to enable cookies in their browser, and if it’s not enabled, then it will redirect on the cookie CMS page as selected above.
Session Validation Settings
Let me explain this to you in simple language, Session validation has variables settings and every time customer visits the store and login, the system tries to match the variable validation, and if any of the validation gets failed, the customer will be logged out or his session will be terminated by the system immediately.
Now the question will come to your mind is, Why Magento has included these settings? Well, It will help you to prevent attacks from hackers, possible session fixation attacks, or attempts to poison or hijack user sessions.
Although, these settings have one drawback and that is it can impact on your performance and enabling all the validation variables can be unduly restrictive, and prevent access to customers who have Internet connections that pass through a proxy server, or that originate from behind a firewall. By default, all the settings are disabled except Use SID on the storefront.
Suggestion from my end is that, see what settings are good for your customers and set those combinations according to your business needs.
Validate REMOTE_ADDR: To verify that the IP address of a request matches what is stored in the $ _SESSION variable, set Validate REMOTE_ADDR to Yes.
Validate HTTP VIA: To verify that the proxy address of an incoming request matches what is stored in the $ _SESSION variable, set Validate HTTP_VIA to Yes.
Validate HTTP_X_FORWARDED_FOR: To verify that the forwarded-for address of a request matches what is stored in the $ _SESSION variable, set Validate HTTP_X_FORWARDED_FOR to Yes.
Validate HTTP_USER_AGENT: To verify that the browser or device that is used to access the store during a session matches what is stored in the $ _SESSION variable, set Validate HTTP_USER_AGENT to Yes.
Use SID on Storefront: If you want a user to stay logged in while switching between stores, set Use SID on Frontend to Yes. (This option only applies if you have multi storeviews, and you want your user to log in, no matter how many times customers switches to any storeview)
Browser Capabilities Detection
You know already, every website needs JavaScript and cookies to be enabled on visitors’ browsers for full operation of the website. However, you may find some customers who are very keen on their privacy settings, and they might have disabled these both in their browser. Magento allows such customers to guide them if it is disabled, and here is the meaning of this configuration.
Redirect to CMS-Page if Cookies are Disabled: To display instructions that explain how to configure the browser to allow cookies, set Redirect to CMS-page if Cookies are Disabled to Yes.
Show Notice if JavaScript is Disabled: To display a banner above the header when JavaScript is disabled in the user’s browser, set Show Notice if JavaScript is Disabled to Yes.
Show Notice if Local Storage is Disabled: To display a notice to users about their local storage is disabled to store the data in the browser.
Over to you!
So, here is all the information you need about the General web configuration settings available in the power-packed Magento 2 community edition. Using this advanced configuration setting, you will be able to setup the different URL options available, base URL, default pages, default layout, default cookie settings, session validation setting, and browser capabilities detection. Make sure you use them as per your store’s requirements and need. Try to simplify things for you and for your customers as well.
Lastly, if you found this tutorial helpful, then don’t forget to share it with your colleagues and Magento Friends. Let us know if you need any support for your Magento store.
Thank you for reading this and stay tuned for the next tutorial. If you have any queries, feel free to comment below.