askvity

How Do I Remove the WWW From WordPress?

Published in WordPress Configuration 3 mins read

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:

  1. 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).

  2. Navigate to General Settings: In the left-hand sidebar, hover over "Settings" and click on "General."

  3. 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 to http://yourdomain.com or https://www.yourdomain.com to https://yourdomain.com.

  4. 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 type www.yourdomain.com are automatically redirected to yourdomain.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 all www 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.

Related Articles