I want to change address from a www to a non www – but how?

[ad_1]

Hi,

my website is online from yesterday but I just noticed that is www instead of not having one (which is the option that I prefer)

I only have a copuple of pages and an article for now, but before adding more contents and sharing the url in social medias I want to change the domain to a non-www

I’ve changed the url in the WordPress general settings, resulting in login not working after that

So I’ve changed the wp-config.php adding
`define(‘WP_SITEURL’, ‘`[`https://www.example.com`](https://www.example.com)`’);`
`define(‘WP_HOME’, ‘`[`https://www.example.com`](https://www.example.com)`’);`

and now I’m back (but the option inside wordpress is now greyed out

how can I switch everything to a non-www?

Looks like my hosting allow to do so but there’s an article with no guide

Thank you in advance

[ad_2]
1 Comment
  1. To change your website’s address from “www” to “non-www”, you can use a few different methods, including:

    Updating Your WordPress Settings: If your website is built using WordPress, you can update your website’s settings to redirect from “www” to “non-www”. To do this, log in to your WordPress dashboard, navigate to the “Settings” section, and update the “WordPress Address (URL)” and “Site Address (URL)” to use the “non-www” version of your website’s address.

    Modifying Your .htaccess File: You can use a .htaccess file to redirect traffic from “www” to “non-www”. To do this, you will need to access your website’s .htaccess file and add the following code:

    ruby

    Copy code

    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]

    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    Updating Your DNS Settings: You can also modify your domain’s DNS settings to redirect traffic from “www” to “non-www”. To do this, you will need to access your domain registrar’s control panel and modify the “CNAME” record to use the “non-www” version of your website’s address.

    By using one of these methods, you can redirect traffic from “www” to “non-www”, ensuring that visitors to your website are directed to the correct version of your website’s address. Keep in mind that these changes may take some time to propagate and become effective, so be patient and monitor your website’s performance after making the changes.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer