Wordpress: Remove the www. from my domain - HELP!!

6 replies
Ok so let me try to explain this.

I just setup an ssl on my wordpress site.
Everything is great, the https lock is green and we're all good to go.
However, i noticed that it says https://www.mysite.com
But I want to make it say https://mysite.com (essentially im looking to remove the www.)

Now, I've gone into wordpress and changed the following to settings on another blog of mine.
WordPress Address (URL)
Site Address (URL)

But it TOTALLY ruined my site. I mean to the point where i had to erase the entire install and database and start from scratch. (my guess is that i did something wrong (obviously) or there was another setting that i should have also changed, i dont know)

So can someone please explain how I can go about removing the www. from my wordpress url.

Thank you in advance
#domain #remove #site address #wordpress #www
  • Profile picture of the author emptee
    Hi LegendaryDreamer,

    My first piece of advice is to install Fiddler - this way you can check what the server is sending back (or what the browser is querying). The number of times I've been banging my head against a wall trying to figure out why a 301 isn't working as expected, only to find out Chrome is being VERY aggressive with it's caching..

    Once that's out of the way, if you can see a request in Fiddler for http://mysite.com and you're getting a 301/302/307 for http://www.mysite.com, start looking at your .htaccess and your .conf file (if apache).

    Let me know how you get on, post the contents of your .htaccess if you're having trouble, or your conf file for apache if applicable

    Cheers,
    Michael

    Originally Posted by LegendaryDreamer View Post

    Ok so let me try to explain this.

    I just setup an ssl on my wordpress site.
    Everything is great, the https lock is green and we're all good to go.
    However, i noticed that it says https://www.mysite.com
    But I want to make it say https://mysite.com (essentially im looking to remove the www.)

    Now, I've gone into wordpress and changed the following to settings on another blog of mine.
    WordPress Address (URL)
    Site Address (URL)

    But it TOTALLY ruined my site. I mean to the point where i had to erase the entire install and database and start from scratch. (my guess is that i did something wrong (obviously) or there was another setting that i should have also changed, i dont know)

    So can someone please explain how I can go about removing the www. from my wordpress url.

    Thank you in advance
    {{ DiscussionBoard.errors[9682993].message }}
  • Profile picture of the author razorf1sh1
    On the DNS, see if www is pointing to your site's ip address A record
    {{ DiscussionBoard.errors[9687082].message }}
  • Profile picture of the author briannn
    Apply these lines on your site .htaccess file

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    Source:
    apache - Generic htaccess redirect www to non-www - Stack Overflow
    {{ DiscussionBoard.errors[9702514].message }}
  • Profile picture of the author peterachutha
    Hi LegendaryDreamer,

    This is the code I am using on my site. You could use the following in your htaccess file

    #php - Force SSL/https using .htaccess and mod_rewrite - Stack Overflow
    #converts all to https
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Redirect www urls to non-www Force users to use the WWW or Non-WWW version of your domain - Htaccess Basics
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.mydomain\.com [NC]
    RewriteRule (.*) https://mydomain.com/$1 [R=301,L]

    Do note some documentation replaces all the . (dots) with \. and other documentations leave them as plain . (dots) without the \ .Try out both versions to see.

    Do replace the "mydomain.com" in the code with your domain name.
    {{ DiscussionBoard.errors[9771012].message }}
    • Profile picture of the author Jeremy Morgan
      All of this advice is correct, however the missing piece is in the database settings of wordpress itself.

      Open up the MySQL database for your WP install in PhpMyAdmin or similar utility.

      Look for the wp_options table

      siteurl field
      home field

      Both of these will also need to be changed.
      Signature
      Jeremy Morgan, Software Developer / SEO
      Learn AI Powered Content Creation
      at Prompt and Prosper
      {{ DiscussionBoard.errors[9772003].message }}
  • Profile picture of the author ezjob
    Do you have your site running through CloudFlare?

    I know that they add the www. to my domain after adding my website to their program. I don't know why they do it but I know that their service is supposed to optimize your website so it loads faster in the browser.

    You can ask your hosting provider if your site is using CloudFlare service. It might be in your cPanel. Mine is.

    Hope this helps,
    James
    {{ DiscussionBoard.errors[9802849].message }}

Trending Topics