Changes between Initial Version and Version 1 of how-to/wordpress/change-site-url


Ignore:
Timestamp:
May 22, 2018, 4:55:59 PM (6 years ago)
Author:
JaimeV
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • how-to/wordpress/change-site-url

    v1 v1  
     1The official wordpress documentation recommends several valid methods of changing your site url.
     2
     3https://codex.wordpress.org/Changing_The_Site_URL
     4
     5If you still have access to the wordpress admin interface for your site under the  "Settings->General" screen changing the values of the two fields named "WordPress Address (URL)" and "Site Address (URL)" is the easiest way to do this.
     6
     7However if you do not have access to the admin interface or want to be sure that this value is changed everywhere in your site we recommend using the [ https://github.com/wp-cli/wp-cli ] utility which we've installed on all of our standard servers for you. You will need to access the command line [ https://support.mayfirst.org/wiki/faq/security/secure-shell | via ssh ] to use this tool.
     8
     9Once you have access to the server you can navigate using the change directory command {{{cd}}} to your web folder or the folder that contains your wordpress installation before invoing the wp-cli utility with the command {{{wp}}.
     10
     11wp-cli can both check and directly set the siteurl configuration value from the command line.
     12
     13{{{
     140 siteuser@server:~/sitename.org/web$ wp option get siteurl
     15
     16http://sitename.org
     17}}}
     18
     19In this example we will replace http with https for the site.
     20
     21{{{
     220 siteuser@server:~/sitename.org/web$ wp option set siteurl https://sitename.org
     23}}}
     24
     25
     26The wp-cli utility can also [https://developer.wordpress.org/cli/commands/search-replace/ search and replace] any instances of a string in your database to replace text embedded in posts and other configuration fields in your site that might still be pointing to the old url.
     27
     28This example uses the {{{--dry-run}}} argument to test without making any real changes. Remove the {{{--dry-run}}} argument and run again to make those changes effective.
     29{{{
     300 siteuser@server:~/sitename.org/web$  wp search-replace --dry-run http://sitename.org https://sitename.org --skip-columns=guid
     31}}}
     32
     33You may also choose to use the same method to ensure other versions of the url that might exist in your site. Below are just a couple of examples
     34
     35{{{
     360 siteuser@server:~/sitename.org/web$  wp search-replace  --dry-run  http://www.sitename.org https://sitename.org --skip-columns=guid
     37}}}
     38
     39{{{
     400 siteuser@server:~/sitename.org/web$  wp search-replace  --dry-run  http://oldsitename.org https://sitename.org --skip-columns=guid
     41}}}
     42