2

I am transferring my blog over from a subdomain to domain and was wondering how to write the very specific 301 redirects.

blog.domain.com/blog-post >> domain.com/blog-post

blog.domain.com/blog-post-2 >> domain.com/blog-post-2

We are leaving our current content service (Hubspot) which required the subdomain. I have about 20 URLs to redirect.

Thanks!

Fuj50
  • 21
  • 2

1 Answers1

0

You can use this rewrite rule:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog.domain.com$
RewriteRule ^(.*)$ domain.com/$1 [R=301,L]

It will redirect requests for blog.domain.com/uri to domain.com/uri

Elvis Plesky
  • 3,190
  • 1
  • 12
  • 21