Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. WordPress (Developer)
  3. Change domain Url in Wp mysql DB when cloning or moving app on a new domain

Change domain Url in Wp mysql DB when cloning or moving app on a new domain

Scheduled Pinned Locked Moved WordPress (Developer)
4 Posts 2 Posters 640 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    p44
    translator
    wrote on last edited by
    #1

    Dear all,

    This is a feature request related to Wordpress, I don't know if keep post here or in "Feature request" area.

    Cloning or migrating a Wordpress website to mydomain.tld to mynewdomain.tld requires also to change mydomain.tld to mynewdomain.tld in mysql database.

    To do this, usually I use Better Search Replace plugin, and of course it takes more steps.

    Could be interesting to integrate this kind of change while cloning or moving app via Cloudron web interface.

    Now Cloudron customize domain in wp-config.php and could be interesting to have that change also in mysql database.

    What do you think? Is a good idea?

    Thank's a lot

    M 1 Reply Last reply
    0
    • P p44

      Dear all,

      This is a feature request related to Wordpress, I don't know if keep post here or in "Feature request" area.

      Cloning or migrating a Wordpress website to mydomain.tld to mynewdomain.tld requires also to change mydomain.tld to mynewdomain.tld in mysql database.

      To do this, usually I use Better Search Replace plugin, and of course it takes more steps.

      Could be interesting to integrate this kind of change while cloning or moving app via Cloudron web interface.

      Now Cloudron customize domain in wp-config.php and could be interesting to have that change also in mysql database.

      What do you think? Is a good idea?

      Thank's a lot

      M Offline
      M Offline
      msbt
      App Dev
      wrote on last edited by
      #2

      @p44 the config itself can be updated via run.sh if you enter those lines:

      mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} <<< "UPDATE wp_options SET option_value = '${CLOUDRON_APP_ORIGIN}' WHERE wp_options.option_name = 'siteurl';"
      mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} <<< "UPDATE wp_options SET option_value = '${CLOUDRON_APP_ORIGIN}' WHERE wp_options.option_name = 'home';"
      

      this however doesn't update your internal links which are often set absolute instead of relative, so you probably need search and replace after all.

      P 1 Reply Last reply
      2
      • M msbt

        @p44 the config itself can be updated via run.sh if you enter those lines:

        mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} <<< "UPDATE wp_options SET option_value = '${CLOUDRON_APP_ORIGIN}' WHERE wp_options.option_name = 'siteurl';"
        mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} <<< "UPDATE wp_options SET option_value = '${CLOUDRON_APP_ORIGIN}' WHERE wp_options.option_name = 'home';"
        

        this however doesn't update your internal links which are often set absolute instead of relative, so you probably need search and replace after all.

        P Offline
        P Offline
        p44
        translator
        wrote on last edited by
        #3

        @msbt Really interesting.

        How to performe this action on ALL database, even internal links?

        Do you think a feature that do this automatically, could be interesting to use when migrating-clone a WP instance?

        M 1 Reply Last reply
        0
        • P p44

          @msbt Really interesting.

          How to performe this action on ALL database, even internal links?

          Do you think a feature that do this automatically, could be interesting to use when migrating-clone a WP instance?

          M Offline
          M Offline
          msbt
          App Dev
          wrote on last edited by
          #4

          @p44 for me personally I wouldn't want that. When I use the clone feature, it clones an empty WP with a few basics installed to start the development process. When I migrate that to prod, I use duplicator, which does the heavy lifting and replacing.

          1 Reply Last reply
          2
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Bookmarks
          • Search