I am starting with domains that look like this:
www.exemple.com
main.testsite.com
www.ex-emple.com.ar
main.test-site.co.uk
en.tour.mysite.nl
www.ip.com
www.one.lv
and I need to remove the subdomains to get values that look like this:
exemple.com
testsite.com
ex-emple.com.ar
test-site.co.uk
mysite.nl
ip.com
one.lv
other top level domains:
.ac
.ad
.ae
.af
.ag
.ai
.al
.am
.ao
.aq
.ar
.as
.asia
.at
.au
.aw
.ax
.az
.ba
.bb
.bd
.be
.bf
.bg
.bh
.bi
.bj
.bm
.bn
.bo
.br
.bs
.bt
.bw
.by
.bz
.ca
.cc
.cd
.cf
.cg
.ch
.ci
.ck
.cl
.cm
.cn
.co
.co.ao
.co.ba
.co.bw
.co.cc
.co.ck
.co.cr
.co.fk
.co.id
.co.il
.co.im
.co.in
.co.jp
.co.ke
.co.kr
.co.ls
.co.ma
.co.mz
.co.nl
.co.nz
.co.th
.co.tz
.co.ug
.co.uk
.co.uz
.co.ve
.co.vi
.co.za
.co.zm
.co.zw
.com
.com.af
.com.ag
.com.ai
.com.al
.com.ar
.com.au
.com.aw
.com.az
.com.bb
.com.bd
.com.bh
.com.bi
.com.bm
.com.bn
.com.bo
.com.br
.com.bs
.com.bt
.com.by
.com.bz
.com.cm
.com.cn
.com.co
.com.cu
.com.cv
.com.cy
.com.do
.com.dz
.com.ec
.com.ee
.com.eg
.com.es
.com.et
.com.fj
.com.ge
.com.gh
.com.gi
.com.gl
.com.gn
.com.gp
.com.gr
.com.gt
.com.gu
.com.hk
.com.hn
.com.hr
.com.ht
.com.jm
.com.jo
.com.kg
.com.kh
.com.ki
.com.kw
.com.ky
.com.kz
.com.lb
.com.lc
.com.lk
.com.lr
.com.lv
.com.ly
.com.mg
.com.mk
.com.mm
.com.mo
.com.mt
.com.mu
.com.mv
.com.mw
.com.mx
.com.my
.com.na
.com.nf
.com.ng
.com.ni
.com.np
.com.nr
.com.om
.com.pa
.com.pe
.com.pg
.com.ph
.com.pk
.com.pl
.com.pr
.com.ps
.com.pt
.com.py
.com.qa
.com.ro
.com.sa
.com.sb
.com.sc
.com.sg
.com.sl
.com.sn
.com.sv
.com.sy
.com.tj
.com.tn
.com.tr
.com.tt
.com.tw
.com.ua
.com.uy
.com.uz
.com.vc
.com.ve
.com.vi
.com.vn
.com.ye
.cr
.cv
.cx
.cy
.cz
.de
.dj
.dk
.dm
.do
.dz
.ec
.edu
.ee
.eg
.es
.eu
.fi
.fj
.fk
.fm
.fo
.fr
.ga
.gd
.ge
.gf
.gg
.gh
.gi
.gl
.gm
.gn
.gov
.gp
.gq
.gr
.gs
.gt
.gu
.gy
.hk
.hm
.hn
.hr
.ht
.hu
.id
.ie
.il
.im
.in
.io
.iq
.is
.it
.je
.jm
.jo
.jp
.ke
.kg
.kh
.ki
.km
.kn
.kr
.kw
.ky
.kz
.la
.lb
.lc
.li
.lk
.lr
.ls
.lt
.lu
.lv
.ly
.ma
.mc
.md
.me
.mg
.mil
.mk
.ml
.mm
.mn
.mo
.mobi
.mp
.mq
.mr
.ms
.mt
.mu
.mv
.mw
.mx
.my
.na
.name
.nc
.ne
.ne.jp
.net
.net.ck
.net.cm
.net.in
.nf
.ng
.ni
.nl
.no
.np
.nr
.nu
.nz
.og.ao
.om
.or.th
.org
.org.ck
.org.cn
.org.ls
.pa
.pe
.pf
.pg
.ph
.pk
.pl
.pm
.pn
.pr
.pro
.ps
.pt
.py
.qa
.re
.ro
.rs
.ru
.rw
.sa
.sb
.sc
.se
.sg
.sh
.si
.sk
.sl
.sm
.sn
.so
.sr
.st
.su
.sv
.sy
.tc
.td
.tf
.tg
.th
.tj
.tk
.tl
.tm
.tn
.to
.tr
.tt
.tv
.tw
.tz
.ua
.ug
.uk
.us
.uy
.uz
.vc
.ve
.vg
.vi
.vn
.vu
.wf
.ws
.xxx
.ye
.yt
.za
.zm
.zw
You cannot delete a subdomain from the domain manager if it is currently set as the primary domain for any of your content tools. You will need to first make the domain secondary and then delete.
Another way you can remove your subdomain from Google search is via user header x tags – X-Robots-Tag: noindex. This is usually very effective for removing each page in a domain or subdomain. Some webmasters or programmers like this method since it does not alter or change the way you create a page.
Organizations owning a large number of subdomains might suffer from incorrect configurations, which allow an attacker to make subdomains resolve to malicious hosts. This problem, called subdomain takeover, is a serious and widespread security risk that received attention also from the general media.
var result = string.replace(/^[^.]+\./g, "");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With