arifaydin.devtürkçe

back to blog

moving a site to a new domain without dropping out of search

What to do when consolidating a site that lives on two domains: path-preserving 301s, consistent canonicals, the sitemap, Search Console's change of address, and structured data for name searches.

For a while my personal site was live on two domains at once. It sounds harmless: two addresses, same content, more visibility. In practice it’s the opposite. To a search engine, two copies are two pages competing for the same ranking. Worse, if the page itself says “my real address is over there” and that other domain doesn’t load for some reason, there’s nothing left to index at all.

This post is the list of what I did, in order, to consolidate the site on one domain.

1. does the canonical address actually load?

This line in every page’s <head> tells search engines the page’s real address:

<link rel="canonical" href="https://arifaydin.dev/">

The hreflang links, Open Graph og:url, the url in JSON-LD and the URLs in the sitemap should all point to the same domain. If they’re consistent but that domain doesn’t load, you’ve told the search engine “the real page is the one that doesn’t open.” Before moving anything, confirm the target domain really returns 200 from the outside:

curl -s -o /dev/null -w "%{http_code}\n" https://arifaydin.dev/

2. old domain: 301 every path to the same path

Redirecting every page of the old domain to the new home page is a common mistake. A visitor to /tr/blog should land on /tr/blog, not on the home page. In nginx it’s one line:

location / {
    return 301 https://arifaydin.dev$request_uri;
}

$request_uri keeps the path and the query string: /blog?x=1 → https://arifaydin.dev/blog?x=1.

Before redirecting, check who else uses the old domain. A path on the old domain may still serve an API or another service; if some app’s frontend calls that address directly, redirecting everything blindly breaks that app too. If there is such a path, leave it out of the redirect:

location /api { proxy_pass http://127.0.0.1:3000; }
location / { return 301 https://arifaydin.dev$request_uri; }

A quick grep for the old domain across your source code surfaces this kind of surprise early.

Use 301, not 302. A 302 means “temporary,” and the search engine keeps holding on to the old address.

3. sitemap: the index file looks empty, and that’s fine

Astro’s sitemap integration produces two files:

  • sitemap-index.xml: only a list of the other sitemap files,
  • sitemap-0.xml: the actual list of pages.

Opening sitemap-index.xml and seeing a single URL can be confusing, but that’s the format: large sites split their page list across several files and the index collects them. Submitting the index to Search Console is enough.

If Search Console says the sitemap “couldn’t fetch,” first confirm the file is reachable for Googlebot:

curl -A "Googlebot" -s -o /dev/null -w "%{http_code} %{content_type}\n" \
  https://arifaydin.dev/sitemap-index.xml

If you see 200 and xml, the error most likely comes from an attempt made before the site was reachable. Removing and resubmitting the sitemap, or waiting a few days, sorts it out. Also make sure the Sitemap: line in robots.txt points to the new domain.

4. search console: two domains, one change of address

  1. Add both the old and the new domain as Domain properties (a TXT record in DNS).
  2. Submit the sitemap on the new domain, and use URL inspection → Request indexing for the main pages.
  3. In the old domain’s property, use Settings → Change of address and pick the new domain.

The change-of-address tool checks that the redirects work, which is why the path-preserving 301 in step 2 matters.

5. if you want to be found by name, the name has to be on the page

The main goal of a personal site is usually name searches. One simple rule applies: a search engine won’t match you to a name that isn’t on the page. If people also search for you with your middle name, that name has to appear visibly.

Three places are enough:

  • <title>: Arif Aydın (Arif Emre Aydın) – Software Developer
  • Visible text: the intro line right under the heading.
  • JSON-LD Person data:
{
  "@type": "Person",
  "name": "Arif Aydın",
  "alternateName": ["Arif Emre Aydın", "Arif Aydin", "Arif Emre Aydin"],
  "givenName": "Arif",
  "additionalName": "Emre",
  "familyName": "Aydın",
  "url": "https://arifaydin.dev",
  "sameAs": [
    "https://github.com/arifaydin16",
    "https://www.linkedin.com/in/arif-ayd%C4%B1n-925369269/"
  ]
}

Putting spellings with and without Turkish characters in alternateName covers people who type “Aydin.” sameAs says that profiles like GitHub and LinkedIn belong to the same person; having those profiles link back to the site makes the connection two-way.

summary

  • Canonical, hreflang, og:url, JSON-LD and the sitemap should all point to one domain, and that domain should load.
  • Redirect the old domain with path-preserving 301s; leave API paths that are still in use out of it.
  • Submit the sitemap on the new domain and use the change-of-address tool.
  • Every name you want to be found by should appear on the page and in the structured data.

The rest is time and content. This post is part of that.