WordPress Copy a Website: Difference between revisions

mNo edit summary
mNo edit summary
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.


==File Contents==
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 requested donations)
*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


===Commands===
===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' /var/www/html/www.RiseOfTheSaltonSea.com --exclude=*.{dll,exe,png,jpg,webp,bcmap,z,tmp,pdf,zip,pack,idx,swf,ORIGINAL} | xargs sed -i 's/WhatEverTextPatternToBeReplaced/WhatEverNewTextPattern/g'
*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.