Today I am tell you how to redirect Non-WWW to WWW URL,
If you want that when someone open your website with your Domain Name and https://www.domain.com should automatically add before your domain so we are create redirect from Non-WWW to WWW.
For Creating Redirection Non-WWW to WWW we will create 301 redirect on .htaccess and will change on your WP-ADMIN from its setting
First we need to edit .htaccess fie which is on your root folder of your website. You can access your .htaccess on public_html folder in your Cpanel,
When you open your .htaccess file after </IfModule> line your need to add this code
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule (.*) http://www.domail.com/$1 [R=301,L]
Replace domain.com with your domain name for example
RewriteCond %{HTTP_HOST} ^asad-iqbal.com$ [NC]
RewriteRule (.*) http://www.asad-iqbal.com/$1 [R=301,L]
Once you saved your .htaccess file then go to WordPress Dashboard then go to setting > general and then change Site Address (URL) to http://www.domain.com and save it
Once you done with all those steps then do Refresh and check your website URL