The Difference Between Subdomains and Subdirectories for SEO; How to Use Reverse Proxies to Resolve Subdomain Issues

The Difference Between Subdomains and Subdirectories for SEO; How to Use Reverse Proxies to Resolve Subdomain Issues
CapGo AI founder shares AI SEO insights at Ahrefs Summit

In SEO (search engine optimization), the choice between subdomains and subdirectories can have a real impact on a website's ranking and traffic performance, despite Google's official claim that there is no significant difference between the two in terms of SEO.

🧠 I. SEO Differences Between Subdomains and Subdirectories

What are Subdomains and Subdirectories?

  • Subdomain:
    Example: blog.example.com
    A “separate website” under the main domain, treated by search engines as an independent site.
  • Subdirectory:
    Example: example.com/blog
    A directory under the main site, part of the same website structure.

Differences in Actual SEO Performance

✅ Actual experience shows:Placing content in a subdirectory often results in 2x-3x better natural SEO performance, especially in the early stages or when aiming to share weight with the main site.

🔄 II. Map Subdomains to Subdirectories Using a Reverse Proxy

To balance flexibility in development and deployment (such as deploying blogs or applications on independent servers or systems), you can use a reverse proxy to “map” subdomain content to subdirectory paths on the main domain.

🛠 Example: Using Nginx to implement Subdomain -> Subdirectory mapping

Scenario:

  • You have a blog system at blog.example.com
  • You want users to be able to access it via example.com/blog/

🔧 Nginx configuration example:

server {
listen 80;
server_name example.com;

location /blog/ {
proxy_pass http://blog.example.com/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

# Prevent path confusion
proxy_redirect off
;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

# Clean up subdirectory paths (optional, depending on application support)
sub_filter_once off
;
sub_filter 'href="https://capgo.ai/blogs/' 'href="https://capgo.ai/blogs/blog/';
sub_filter 'src="https://capgo.ai/blogs/' 'src="https://capgo.ai/blogs/blog/';
}
}

Read more

如果用建站工具设置子域名

如果用建站工具设置子域名

以下是一个详细指南,教你如何为建站工具(比如 CapGo, Webflow、Framer、Wix 等)设置一个 子域名(subdomain),比如 site.yourdomain.com: 🧭 一、前提条件 在开始之前,你需要准备: 1. ✅ 一个已注册的主域名(例如 yourdomain.com) 域名注册商可以是 GoDaddy、Namecheap、阿里云、腾讯云等。 2. ✅ 访问你的域名 DNS 管理面板的权限。 3. ✅ 你的网站(例如 Webflow 发布后)已经有了一个目标地址(通常 Webflow 会告诉你需要添加哪些记录,如 proxy.webflow.io)。 ⚙️ 二、在 Webflow(或其他建站工具)

By CapGo AI - by YG
🌍 多语言网站的 SEO (AEO, GEO) 最佳实践:子目录结构与语言代码规范

🌍 多语言网站的 SEO (AEO, GEO) 最佳实践:子目录结构与语言代码规范

在当今全球化的网络环境中,支持多语言的网站已经成为许多品牌的标配。 然而,如何在不同语言之间实现良好的 SEO 表现,却是许多开发者和运营人员容易忽视的关键点。 本文将系统讲解: * 为什么使用**子目录(subfolder/subdirectory)**结构是 SEO 的最佳选择; * 如何正确设置 /en/、/zh-Hans/ 等语言路径; * 以及到哪里可以查找标准的语言代码(如 es 代表西班牙语)。 一、为什么选择子目录结构? 在多语言 SEO 实践中,URL 结构是搜索引擎理解网站语言版本的核心信号之一。 主流方案包括: * 不同顶级域名(ccTLD,如 example.cn 、example.fr) * 子域名(subdomain,如 zh.example.com) * 子目录(subfolder,如 example.com/zh-Hans/

By CapGo AI - by YG