mirror of
https://gh.wpcy.net/https://github.com/CaptainCore/captaincore.git
synced 2026-04-22 20:45:45 +08:00
26 lines
1.1 KiB
Bash
Executable file
26 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
#
|
|
# Apply SSL using domain without www
|
|
#
|
|
|
|
domain=$(wp option get home)
|
|
domain=${domain/http:\/\/www./} # removes http://www.
|
|
domain=${domain/https:\/\/www./} # removes https://www.
|
|
domain=${domain/http:\/\//} # removes https://
|
|
domain=${domain/https:\/\//} # removes http://
|
|
domain=$( echo $domain | awk '{$1=$1};1' ) # Trims whitespace
|
|
|
|
echo "Search and replace http://$domain to https://$domain"
|
|
wp search-replace http://$domain https://$domain --all-tables --skip-plugins --skip-themes --report-changed-only
|
|
|
|
echo "Search and replace http:\/\/$domain to https:\/\/$domain"
|
|
wp search-replace "http:\/\/$domain" "https:\/\/$domain" --all-tables --skip-plugins --skip-themes --report-changed-only
|
|
|
|
echo "Search and replace http://www.$domain to https://$domain"
|
|
wp search-replace http://www.$domain https://$domain --all-tables --skip-plugins --skip-themes --report-changed-only
|
|
|
|
echo "Search and replace http:\/\/www.$domain to https:\/\/$domain"
|
|
wp search-replace "http:\/\/www.$domain" "https:\/\/$domain" --all-tables --skip-plugins --skip-themes --report-changed-only
|
|
|
|
wp cache flush
|