Redirect domain to a directory while retaining address

I have two domains (example.com and example2.com) that direct to the same location. I want to redirect one of the domains (example2.com) to a directory (example.com/dir), without any of the following occurring:

  • Adress bar shows example.com/dir
  • Adress bar shows example2.com but does not load contents of example.com/dir other than index.html
  • example.com also redirects to example.com/dir

So that:

  • example2.com shows the contents of example.com/dir
  • example2.com/page.html shows the file example.com/dir/page.html

Thanks in advance


Source: .htaccess

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.