Skip to content

Instantly share code, notes, and snippets.

@samsulmaarif
Created February 17, 2020 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samsulmaarif/00b0440fb3cf807c5f20e2c93296637b to your computer and use it in GitHub Desktop.
Save samsulmaarif/00b0440fb3cf807c5f20e2c93296637b to your computer and use it in GitHub Desktop.
cat list-migrasi-domain.txt
domain-lama1.com --> domain-baru1.com
domain-lama2.com --> domain-baru2.com
domain-lama3.com --> domain-baru3.com
domain-lama4.com --> domain-baru4.com
paste -d ' ' `pwd`/list-migrasi-domain.txt | while read lama skip baru; do echo "server {\n\t server_name $lama;\n\t rewrite ^/(.*)\$ http://$baru/\$1 permanent;\n}" >> direktif-baru.txt; done
cat direktif-baru.txt
server {
server_name domain-lama1.com;
rewrite ^/(.*)$ http://domain-baru1.com/$1 permanent;
}
server {
server_name domain-lama2.com;
rewrite ^/(.*)$ http://domain-baru2.com/$1 permanent;
}
server {
server_name domain-lama3.com;
rewrite ^/(.*)$ http://domain-baru3.com/$1 permanent;
}
server {
server_name domain-lama4.com;
rewrite ^/(.*)$ http://domain-baru4.com/$1 permanent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment