Updating WordPress URL Settings

[ad_1]

I noticed some indexing issues in Google Search Console that seem to be related to how my server is handling requests made to www vs non-www versions of my domain and also trailing slashes at the end of the url. I’m hosting in Digital Ocean and this is my first time managing my own server. I have access and made some changes to .htaccess to redirect non-www to the www version which I think are working, but I noticed in my WordPress settings that my WordPress and Site Address settings are still set to the non-www url. I changed this, then couldn’t access wp-admin until I reverted those url settings back by adding `update_option( ‘siteurl’, ‘“http://example.com“’ )` and `update_option( ‘home’, ‘“http://example.com“’ )` in my theme’s functions file. So my question now is it necessary to even update these WordPress settings if I plan to use the www version of my site url and if so, is there a documented procedure to follow so I do not lose access to the admin area?

[ad_2]
1 Comment
  1. wp_options table siteurl and home fields needs to be the correct value, so [https://www.example.com]). I prefer not to set those URLs via functions or wp-config statements, because someone will always forget that they’re there.

    Your webserver config needs to be setup to accept traffic to https/http and www/non-www and redirect [https://www.example.com]) in htaccess.

 

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