Category Archives: Howto Tutorials (EN)

Knowledge Network for Tutorials, Howto’s, Workaround, DevOps Code for Professionals.

Change WordPress URL

Change website URL and links in wordpress database

WordPress conversions and migration require several steps to customize the URL. Setting the WordPress address is in a new installation, under Settings General for WordPress address (URL) and web page address (URL). Further changes are required for migration and URL changes.

Modify WordPress-Aaddress URL using phpMyAdmin

During migration, access to the WP-Admin may be blocked, after that has already been changed the A Record or CNAME in DNS, also the virtual host configuration on the Web server. The URL also needs to be changed when switching the page from Dev to Live. At this point, the website address and the links in the content can be changed with phpMyAdmin.

Change WordPress address (URL) and website address (URL) to phpMyAdmin

To change the WordPress address and website address in phpMyAdmin, you open the database and go to View, in the now opened tree you select the table wp_options, on the left search for siteurl and home in the column option_name, here Edit and modify the value in the field option_value with the new URL and click OK to confirm.

WordPress change record siteurl and home using phpMyAdmin
Illustration: phpMyAdmin

Note: The WordPress default database prefix is wp_, at this point where the prefix was previously changed to wp_futbg5.

If you want to search the database for text, go to Search after opening the database and enter the search argument integrated between % characters. In this case, the developer environment should be made the live page, where dev.artemis.org the developer is URL, and www.artemis.org the live URL of the page.

WordPress search words and pharse using phpMyAdmin
phpMyAdmin Browsing the Database

In the table(s) click on Select All, followed by OK. As a rule, the hits in the tables are wp_posts and wp_postmeta to be found in the field post_content.

In phpMyAdmin the URL can change by using the following SQL command to Find Replace the tables.

UPDATE wp_posts
SET guid =REPLACE(
    Guid
    "dev.artemis.org,"
    "www.artemis.org"
);

UPDATE wp_posts
SET post_content = REPLACE(
    post_content,
    "dev.artemis.org,"
    "www.artemis.org"
);

UPDATE wp_postmeta
SET meta_value = REPLACE(
    meta_value,
    "dev.artemis.org,"
    "www.artemis.org"
);

UPDATE wp_links
SET link_url = REPLACE(
    link_url,
    "dev.artemis.org,"
    "www.artemis.org"
);

If plugins are used that contain tables with URLs, the content must be changed here.

UPDATE table name
SET field_with_url = REPLACE(
    field_with_url,
    "dev.artemis.org,"
    "www.artemis.org"
);

Instead of the placeholder table name and field_with_url enter the actual table name, the relevant plugins with the tables can be found with text search in phpMyAdmin as described above.

Set system locale on Linux

How to set Linux system language using localectl set-locale

Set system locale on Linux

Locales consist of a set of environment variables to define language, country, and character encoding for applications and shell sessions on a Linux system. These environment variables are used by system libraries and country-specific applications on the system.

The locale affects the time and date format, first day of the week, numbers, currency, and many other values formatted according to the language or region (country) set on a Linux system.

Show system locale

The locale and localectl utility provides information about the currently installed locale and changes it when needed.

$ locale
LANG=en_US. UTF-8
LC_CTYPE="en_US. UTF-8"
LC_NUMERIC="en_US. UTF-8"
LC_TIME="en_US. UTF-8"
LC_COLLATE="en_US. UTF-8"
LC_MONETARY="en_US. UTF-8"
LC_MESSAGES="en_US. UTF-8"
LC_PAPER="en_US. UTF-8"
LC_NAME="en_US. UTF-8"
LC_ADDRESS="en_US. UTF-8"
LC_TELEPHONE="en_US. UTF-8"
LC_MEASUREMENT="en_US. UTF-8"
LC_IDENTIFICATION="en_US. UTF-8"
LC_ALL=

Output a list of all available locales.

$ locale -a
C
C.UTF-8
en_US.utf8
POSIX

Change locale using localectl set-locale

If you want to change the locale, the update-locale and localectl command is used. The LANG variable can be used to set the locale for the entire system.

The following command sets LANG to de_DE.UTF-8

$ sudo localectl set-locale LANG=de_DE.UTF-8

Set language settings for user only

To set a locale for a single user, you can simply open the file ~/.bash_profile and add the following lines.

$ LANG = "de_DE.utf8"
Export LANG

Set locale using dpkg-reconfigure locales

For Debian 10 and Debian 11, the dpkg-reconfigure service program is a good way to set the system locale.

$ sudo dpkg-reconfigure locales

The locale settings are located in the following files.

  • /etc/default/locale – Ubuntu/Debian
  • /etc/locale.conf – CentOS/RHEL

These files can also be edited manually using a preferred command line editor, such as Vim or Nano, to configure the system locale.

  The next relevant post might also be helpful. This post How to Set Linux Time Zone in Console shows how to query and set the time zone in the command line.

Further help can be found in the man pages.

$ man locale
$ man update-locale
$ man localectl

Conclusion

This tutorial shows how to change and set a locale in Linux using localectl. Each locale consists of a set of environment variables to define the language, country and character encoding for applications and shell sessions on a Linux system.

The localectl utility can be used to query all the necessary information and make settings to set the locale and the appropriate keyboard layout. This is necessary when, for example, incorrect settings were made during installation and/or the default settings were lost due to updates or software installations. localectl is pre-installed on most Linux systems and is only operated via the terminal.