go-search-replace icon indicating copy to clipboard operation
go-search-replace copied to clipboard

Replacing "subdomain." prefix with empty string ""

Open rivaros opened this issue 3 years ago • 2 comments

Have recently come across your wonderful script to cure Wordpress database copies between domains.

Have one more challenge - I just need to replace "staging." subdomain in all urls mentioned in sql file (including serialized PHP objects).

So replacement is just empty string (""). My wordpress installation is multi-site, so there are multiple subsiteX.maindomain.com urls as well as staging.subsiteX.maindomain.com on staging server.

While migrating from staging to production we need to delete away the "staging." subdomain.

rivaros avatar Aug 19 '21 10:08 rivaros

@joshbetz In your code you check that replacement is at least 2 chars

                to = args[(i*2)+1]
		if !validInput(to, minOutLength) {
			fmt.Fprintln(os.Stderr, "Invalid <to>, minimum length is 2")
			os.Exit(3)
			return
		}

Could this be a problem if that check is removed?

rivaros avatar Aug 19 '21 10:08 rivaros

Can you replace staging.subsiteX.maindomain.com with subsiteX.maindomain.com?

joshbetz avatar Oct 21 '21 20:10 joshbetz