Here are the steps to configure Magento with a new custom domain:
- Purchase the new domain name and point it to your Magento server IP address via DNS A record.
- Login to your Magento admin panel, and go to Stores > Configuration > General > Web.
- In the Base URLs section, update the Base URL and Secure Base URL fields to the new domain name.
- Scroll down to the Base URLs (Secure) section and update the Secure Base URL field as well.
- Go to Stores > Configuration > General > General. Set "Add Store Code to Urls" to "Yes".
- Under Advanced > Developer, update the JavaScript Settings and CSS Settings fields to the new domain.
- Flush the cache under System > Cache Management.
- Setup a 301 redirect in the .htaccess file from old domain to new domain.
- Reindex all indices under System > Index Management.
- Test the new domain thoroughly before launching.