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.

2
  • Because of the reference to .htaccess, I assumed it is Apache and I retagged accordingly.
    – bortzmeyer
    Apr 14, 2010 at 9:53
  • The question is far too vague: is it static files on the disk or some sort of CMS and, if so, which one?
    – bortzmeyer
    Apr 14, 2010 at 9:54

1 Answer 1

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]

You must log in to answer this question.