WordPress address URL keeps dropping the www

My WordPress Address (URL) in general settings keeps losing the www from the URL – I type in http://www.domain.com and it saves and works fine.

Next time I go in the address has changed to http://domain.com. So again I change it, I get logged out and I log back in and it looks fine until next time and it has changed again.

Read More

This is the only setting which changes (site address keeps the www) and I have checked my htaccess and cannot see anything untoward and there are no parked domains etc – any idea what could be causing this?

Most of the time it doesn’t cause any issues but sometimes when I visit the site it defaults to the non www version which could be detrimental to SEO as well as it affects my SSL for some secure pages as I only have the SSL for www.domain.com so I would like to fix it if I can.

Related posts

Leave a Reply

2 comments

  1. You could possibly set the URL in your wp-config.php, this will override the URL stored in the database (the one set in general settings):

    // ** Home- und Site-URL ** //
    define( 'WP_HOME', 'http://www.example.com' );
    define( 'WP_SITEURL', 'http://www.example.com' );
    

    So this should help to keep the www in your URL, but of course it doesn’t solve the strange behaviour itself. One thing I could think of: Can you check if update_option( 'siteurl', 'http://example.com' ); is set anywhere? Typically this is set in functions.php and is used for changing the URL without having access to the backend.