Primary Site Url
For security purposes and to enable some functionality, your site needs to have a single primary base url. For example https://site.com, however users might try to access the site via different versions, for example https://www.site.com or http://site.com. It is recommended to redirect other versions of your site url to the primary version via cpanel or another control panel your hosting might be using.
Changing Primary Site url
Primary site url can be changed by modifying .env file with any text editor. Make sure DNS records for this url are pointed to your server, otherwise the site will stop working.
Redirecting Secondary Versions To Primary URL
This can usually be done from your hosting’s control panel.
- To redirect non-http urls to https, you can usually toggle Force HTTPS Redirect option next to your domain name in Domains page.
- To redirect from “www” version (https://www.site.com) to non-www version (https://site.com), open Redirects page, select your domain, enter full url without www and select “Only redirect with www.”.