To remove the "www" from your WordPress site URL, you need to change the WordPress Address and Site Address settings within your WordPress dashboard. Here's how:
-
Log in to your WordPress Dashboard: Access your WordPress admin area by navigating to your site's URL followed by
/wp-admin
(e.g.,yourdomain.com/wp-admin
). -
Navigate to General Settings: In the left-hand sidebar, hover over "Settings" and click on "General."
-
Modify WordPress Address and Site Address: You'll see two fields:
- WordPress Address (URL): This is the address where your WordPress core files are located.
- Site Address (URL): This is the address visitors type to reach your website.
In both of these fields, remove the "www." from the beginning of your URL. For example, change
http://www.yourdomain.com
tohttp://yourdomain.com
orhttps://www.yourdomain.com
tohttps://yourdomain.com
. -
Save Changes: Scroll to the bottom of the page and click the "Save Changes" button.
Important Considerations:
-
HTTPS: Ensure your site is properly configured for HTTPS (SSL certificate) before making this change if you intend to use HTTPS. Otherwise, visitors might encounter security warnings. Contact your hosting provider if you're unsure how to set up HTTPS.
-
.htaccess Redirection: After making this change, it's generally good practice to set up a redirect in your
.htaccess
file to ensure that visitors who do typewww.yourdomain.com
are automatically redirected toyourdomain.com
(or vice-versa, depending on your preferred configuration). This prevents duplicate content issues that can negatively impact SEO. The following code can be added to your.htaccess
file to redirect allwww
requests to the non-www
version:<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] </IfModule>
Caution: Editing the
.htaccess
file incorrectly can break your website. Back it up before making changes and consult with a developer if you're unsure. You can typically access your.htaccess
file using an FTP client or a file manager in your hosting control panel. -
Caching: Clear your WordPress cache and any browser caches after making this change to ensure the updated URL is displayed correctly.
-
Google Search Console: If you use Google Search Console, make sure to update your preferred domain setting to reflect the change (with or without
www
).
By following these steps, you can successfully remove the "www" prefix from your WordPress site's URL and maintain a consistent and optimized web presence.