How to consolidate the SEO power of subdomains into subdirectories by utilizing reverse proxies.

This article can be read in about 16 minutes.

What is a reverse proxy?

From its English roots, it is a reverse proxy.

What is a surrogate and what is vice versa? First, you need to understand about proxies.

Proxy (Forward Proxy): “Substitute” for the client

A proxy (or forward proxy) is a server that sits between Internet users and the Internet. A proxy server receives a user’s request, sends the request to the desired server on the Internet, and returns the response to the user. This process helps protect your privacy and improve security by hiding your IP address and other personal information.

A proxy server acts as a “proxy” because it communicates with websites on behalf of clients.

Reverse proxy: The “opposite” of a proxy in that it “stands in” for the server.

A reverse proxy is a type of server that operates behind the Internet and receives requests from users on behalf of web servers, retrieves information from the web server based on those requests, and sends it back to the users. This process is transparent to the user.

While a regular proxy is located close to the client side and sends the client’s requests to the Internet on behalf of the client, a reverse proxy is located close to the server side and has the role of receiving external requests and forwarding them to the internal server. This allows the reverse proxy to function as a “proxy that works in the opposite direction.”

Source: https://en.wikipedia.org/wiki/Reverse_proxy

Summary

A proxy server’s role as “proxy” refers to communicating on behalf of other entities (clients or servers) on the Internet. Forward proxies act on behalf of clients and reverse proxies act on behalf of servers.

Domain power and reverse proxy

Domain power relates to how search engines evaluate a site’s overall authority and trustworthiness.

Articles about domain power

SEO effects of changing from subdomain to subdirectory

Subdomains (e.g. blog.example.com) and subdirectories (e.g. example.com/blog) may be evaluated differently by search engines. In general, subdirectories share the authority of the main domain, so even if you launch new content, you can leverage the credibility of your existing domain, which is advantageous for SEO.

[SEO] Click here for an article about the difference between subdomains and subdirectories and Google’s view on the impact on SEO.

When you change a subdomain to a subdirectory using a reverse proxy, URLs appear in subdirectory format, making it easier for search engines to recognize your content as part of the main domain. This can improve the SEO rating of the entire site.

Specific example) Life-related content

If a website that provides lifestyle-related content targeted at a family operates information on housing, cars, and insurance in different subdomains, we need to change to a subdirectory using a reverse proxy and perform SEO. Think about improving effectiveness and UX.

Structure before setup (subdomain)

  • home.example.com (residence)
  • car.example.com(car)
  • insurance.example.com(insurance)

Structure after configuration (subdirectories)

  • example.com/home(residence)
  • example.com/car(car)
  • example.com/insurance(insurance)

Try to improve both SEO and user experience by displaying these categories as tabs in your site’s navigation bar.

Reverse proxy configuration steps

Setting up a reverse proxy will vary depending on the software you use and your specific requirements, but the general steps are below.

Selecting reverse proxy software

  • Choose widely used reverse proxy software, such as Nginx or Apache.

Software installation

  • Install the reverse proxy software of your choice on your server.

Example of configuring proxy settings

  • Edit the reverse proxy’s configuration file to forward client requests to the appropriate backend server.
  • proxy_set_header Host $http_host;Use Proxy Headers: to preserve the original hostname and ensure that the backend server responds appropriately.
  • Handling redirects:proxy_redirect off; is used to not rewrite redirects. A reverse proxy forwards the URL returned from the backend server (subdomain) to the client as is.
Nginx
server {
    listen 80;
    server_name example.com;

    location /home/ {
        proxy_pass http://home.example.com/;
        proxy_set_header Host home.example.com;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /car/ {
        proxy_pass http://car.example.com/;
        proxy_set_header Host car.example.com;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /insurance/ {
        proxy_pass http://insurance.example.com/;
        proxy_set_header Host insurance.example.com;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Applying security settings

  • Configure an SSL/TLS certificate to process requests over an encrypted connection.

Then test and debug.

Overall flow after setting up a reverse proxy

  1. Access from clients: Clients example.com/home/access through subdirectories such as.
  2. Reverse proxy forwardinghome.example.com : Nginx (reverse proxy) forwards this request to the appropriate subdomain’s server (e.g. ).
  3. Backend server processing: The subdomain’s server processes the request and generates a response, including a redirect response if necessary.
  4. Forwarding responses: Reverse proxy (Nginx) receives responses from backend servers. proxy_redirect off;is set, the redirect URL returned by the backend server will be forwarded as is and will not be modified.
  5. Response to the client: The original redirect URL from the backend is passed to the client unchanged.
Nginx
[クライアント] ---> [リバースプロキシ (Nginx)] ---> [バックエンドサーバー]
      |                        |                               |
      |                        |                               |
      |---- http://example.com/home/ --------------------------> http://home.example.com/
      |                        |                               |
      |                        |                               |--- リソース応答
      |                        |<------------------------------|
      |<-----------------------|                               |
      |                        |                               |
      |---- http://example.com/car/ ---------------------------> http://car.example.com/
      |                        |                               |
      |                        |                               |--- リソース応答
      |                        |<------------------------------|
      |<-----------------------|                               |
      |                        |                               |
      |---- http://example.com/insurance/ ---------------------> http://insurance.example.com/
      |                        |                               |
      |                        |                               |--- リソース応答
      |                        |<------------------------------|
      |<-----------------------|                               |

Improved SEO and UX by changing to subdirectories

Aggregation of domain power

By using a reverse proxy to change from a subdomain to a subdirectory, the domain power that was previously dispersed in subdomains is consolidated into the main domain, increasing the authority of the entire site in search engines. Internal links from each category are completed within the main domain, contributing to improving page rank.

Improved circulation of content

Tabs such as housing, cars, and insurance in the top navigation allow users to easily navigate between related content. This is expected to increase the amount of time users spend on the site and improve engagement.

UI/UX consistency and navigation consistency

In order to keep users unaware of moving between subdomains, it is important to maintain consistency in UI/UX design. Specifically, you need a common navigation bar, a similar style guide, and a consistent layout across your site so users don’t feel like they’re navigating between different subdirectories.

Specific UI/UX adjustments

  • Provide a common navigation bar: Provide a common navigation bar on each page, making all major categories easily accessible.
  • Uniform design: Make visual elements consistent across your site, such as colors, fonts, and button styles.
  • Performance optimization: Optimize page loading speed for a smooth user experience.

コメント

Copied title and URL