Dotlayer
  • News
  • Startups
  • Tutorials
  • SEO
  • Marketing
  • Interviews
No Result
View All Result
Dotlayer
  • News
  • Startups
  • Tutorials
  • SEO
  • Marketing
  • Interviews
No Result
View All Result
Dotlayer
No Result
View All Result

How to Use the WP-CLI Command Line Tool to Change Your WordPress Website Url or Domain

March 29, 2018
in Tutorials
0 0
Share on FacebookShare on Twitter

The URL or domain name is by far the simple most important feature of your website. Everyone who visits your website will have to access via the domain name or URL. Having the ability to change it is very useful when it comes to various situations.

There are various situations that you have to change domains, moving to a subdomain, updating from www domain to non-www domain, moving files around, moving from a sub-domain to a main domain or even migrating from HTTP to HTTPS. Whatever the case may be, there are a few different options you have when it comes to changing the URL, some more advanced than others.

In this article, we are going to cover how to use the WP-CLI tool to change the URL of our WordPress website. WP-CLI is the official command line tool for provided by the WordPress team for interacting with and managing your WordPress sites.

The WP-CLI command line tool is essentially a handy application to run various WordPress tasks. Download the WP-CLI command line tool into the WordPress root folder using CURL or WGET.

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Check if the tool is working.

php wp-cli.phar --info

Alternatively, You can follow the tutorial here to view the set-up wp-cli on your server. Not run the search and replace command to look through all the core tables to change the URL.

php wp-cli.phar search-replace 'http://www.olddomain.com' 'http://www.newdomain.com'

This will save you numerous hours and give you some peace of mind!

Alternatively, you can use the option update commands below to change the URL.

wp option update home 'http://example.com'
wp option update siteurl 'http://example.com'

Since people have multiple plugins installed and setup, you want to test this on a staging environment before running it on a production site.

ShareTweetPin
Previous Post

How to Install and Use YouTube-DL – A Command Line Video Download Tool for Linux

Next Post

How to Use Sensu and RabbitMQ on Ubuntu to Monitor Your WordPress Website

Next Post

How to Use Sensu and RabbitMQ on Ubuntu to Monitor Your WordPress Website

You might also like

Mint Linux vs Ubuntu: Which is Right For You?

Mint Linux vs Ubuntu: Which is Right For You?

March 12, 2022
Net Neutrality: What is it and Why Should You Care?

Net Neutrality: What is it and Why Should You Care?

March 12, 2022
Solid State Drives – Why You Should Buy One Today

Solid State Drives – Why You Should Buy One Today

March 12, 2022

Machine Learning Algorithms Every Beginner Should Know

January 25, 2022
What Is the log4j Vulnerability, log4shell, an Example Step-By-Step Exploit and How to Fixed It

What Is the log4j Vulnerability, log4shell, an Example Step-By-Step Exploit and How to Fixed It

December 11, 2021
Simple Video Call integration into Website with Jitsi

Simple Video Call integration into Website with Jitsi

May 26, 2020
  • Terms of Service
  • Privacy Policy
  • Careers

© 2021 Dotlayer.com

No Result
View All Result
  • About Us
  • Advertise
  • Blog
  • Careers
  • Contact
  • Contact Us
  • Get Featured
  • Home Layout 1
  • Home Layout 2
  • Home Layout 3
  • Privacy Policy
  • Security
  • Services
  • Subscribe To Dotlayer
  • Terms of Service
  • Write For Us

© 2021 Dotlayer.com

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In