0

I have content on subdomain1.mydomain.com which can't reside on mydomain.com/subdomain1. Nevertheless, all my other content resides in folders of the mydomain.com/subdomain* type.

For the sake of consistency, I'd like the content actually located at subdomain1.mydomain.com to appear as if it were on mydomain.com/subdomain1 — Is there any way, using .htaccess, that I can achieve this, bearing in mind that:

(1) the subdomain itself also has a nested permalink structure, meaning that there are additional folders in the directory structure of the subdomain;

(2) I want the browser to display the address as mydomain/subdomain1 after the redirect.

bortzmeyer
  • 3,941
  • 1
  • 21
  • 24

1 Answers1

1

Not sure why this has a DNS tag. DNS will not do what you want. DNS is designed to resolve host name to an ip address (A record) and vice versa (PTR record). It can also point one hostname to another hostname, and this is called a CNAME record.

As far as redirecting subdomain1.domain.com to domain.com/subdomain1

try something like this

RewriteEngine On
RewriteCond    %{HTTP_HOST} ^subdomain1\.
RewriteRule    /(.*) http://www.domain.com/subdomain1/$1 [R=301,L]
solefald
  • 2,301
  • 15
  • 14