Migrating content from a URL subfolder (example.com/docs/) to a standalone subdomain (docs.example.com) requires configuring 301/308 redirects in Nginx or Apache to preserve SEO search equity.
Nginx Subfolder to Subdomain Redirect Block
server {
server_name example.com;
# Redirect subfolder /docs/ to docs.example.com
location /docs/ {
rewrite ^/docs/(.*)$ https://docs.example.com/$1 permanent;
}
}
Comments and corrections