Difference between revisions of "WordPress Copy a Website"
m |
m |
||
Line 3: | Line 3: | ||
It's a lot like 'moving' a WordPress website, but with some extra stuff. | It's a lot like 'moving' a WordPress website, but with some extra stuff. | ||
== | The key is chaning the Domain Name from the old to the new. | ||
== Copy Files and Database == | |||
cp -ax WhatEverSourcePath WhatEverDestinationPath | |||
mysqldump -u root -p WhatEverSourceDatabase > WhatEverFileName | |||
mysql -u root -p WhatEVerDestinationDatabase < WhatEverFileName | |||
== Modify Domain Name in Database == | |||
Use the Better Search and Replace Plugin: Enter Old and New Domain Names, Select Tables by clicking the Top Item in Select tables, then scrolling to the bottom, holding the Shift Key and clicking on the Bottom Item, Case-insensitive: UNchecked, Replace GUIDs: CHECKED, Run as Dry run: UNchecked | |||
==Modify Domain Name in Files (Don't do this until all the database replacements have been done)== | |||
===Utilities (for Windows)=== | ===Utilities (for Windows)=== | ||
*Advanced Find and Replace ($) | *Advanced Find and Replace (costs $) | ||
*Find and Replace (Free, with | *Find and Replace (Free, with donation request) | ||
**Suggested Exclude Mask: *.dll, *.exe, *.png, *.jpg, *.webp, *.bcmap, *.z, *.tmp, *.pdf, *.zip, *.pack, *.idx, *.swf, *.ORIGINAL | **Suggested Exclude Mask: *.dll, *.exe, *.png, *.jpg, *.webp, *.bcmap, *.z, *.tmp, *.pdf, *.zip, *.pack, *.idx, *.swf, *.ORIGINAL | ||
**Suggested Settings: Case Sensitive (turn it ON) | **Suggested Settings: Case Sensitive (turn it ON) | ||
Line 14: | Line 26: | ||
===Utilities (for WordPress)=== | ===Utilities (for WordPress)=== | ||
*String Locator | *String Locator Plugin | ||
=== | ===Command Line=== | ||
*This command will locate strings within files; | *This command will locate strings within files; | ||
Line 26: | Line 38: | ||
...but, don't want to just find strings, want to replace them, so; | ...but, don't want to just find strings, want to replace them, so; | ||
* grep -rl 'WhatEverTextPatternToBeReplaced' | *grep -rl 'WhatEverTextPatternToBeReplaced' WhatEverPathNameOfFiles --exclude=*.{dll,exe,png,jpg,webp,bcmap,z,tmp,pdf,zip,pack,idx,swf,ORIGINAL} | xargs sed -i 's/WhatEverTextPatternToBeReplaced/WhatEverNewTextPattern/g' | ||
...and with a frustrating note, in that the above doesn't account for spaces (if there are any, in file names and directory names). Couldn't find a solution as grep simply will not produce any output, even with --null and / or -Z that xargs -0 will pay attention to. Woof! | ...and with a frustrating note, in that the above doesn't account for spaces (if there are any, in file names and directory names). Couldn't find a solution as grep simply will not produce any output, even with --null and / or -Z that xargs -0 will pay attention to. Woof! | ||
=== Speed Note === | |||
As for speed, the Command Line is about a hundred times faster than doing it from Windows over a network connection. |
Revision as of 19:32, 30 May 2022
If you've got the perfect WordPress website and want to copy it, here's how to do it. Perfect here is more focused on the backend and administrative stuff, not the content of the site. IE, Plugins, custom themes, and other customizations, etc.
It's a lot like 'moving' a WordPress website, but with some extra stuff.
The key is chaning the Domain Name from the old to the new.
Copy Files and Database
cp -ax WhatEverSourcePath WhatEverDestinationPath
mysqldump -u root -p WhatEverSourceDatabase > WhatEverFileName
mysql -u root -p WhatEVerDestinationDatabase < WhatEverFileName
Modify Domain Name in Database
Use the Better Search and Replace Plugin: Enter Old and New Domain Names, Select Tables by clicking the Top Item in Select tables, then scrolling to the bottom, holding the Shift Key and clicking on the Bottom Item, Case-insensitive: UNchecked, Replace GUIDs: CHECKED, Run as Dry run: UNchecked
Modify Domain Name in Files (Don't do this until all the database replacements have been done)
Utilities (for Windows)
- Advanced Find and Replace (costs $)
- Find and Replace (Free, with donation request)
- Suggested Exclude Mask: *.dll, *.exe, *.png, *.jpg, *.webp, *.bcmap, *.z, *.tmp, *.pdf, *.zip, *.pack, *.idx, *.swf, *.ORIGINAL
- Suggested Settings: Case Sensitive (turn it ON)
Utilities (for WordPress)
- String Locator Plugin
Command Line
- This command will locate strings within files;
- grep -Ril WhatEverStringToSearchFor WhatEverPathToSearch
- -R = Recursive (IE, search sub-directories)
- -i = Ignore Case (IE, make the string that is being searched for Case Insensitive)
- -l = Only list the File Names that contain the searched for strings in the results (That's an L (El), not an I (eye) for the switch)
...but, don't want to just find strings, want to replace them, so;
- grep -rl 'WhatEverTextPatternToBeReplaced' WhatEverPathNameOfFiles --exclude=*.{dll,exe,png,jpg,webp,bcmap,z,tmp,pdf,zip,pack,idx,swf,ORIGINAL} | xargs sed -i 's/WhatEverTextPatternToBeReplaced/WhatEverNewTextPattern/g'
...and with a frustrating note, in that the above doesn't account for spaces (if there are any, in file names and directory names). Couldn't find a solution as grep simply will not produce any output, even with --null and / or -Z that xargs -0 will pay attention to. Woof!
Speed Note
As for speed, the Command Line is about a hundred times faster than doing it from Windows over a network connection.