• I have scoured the internet for answers to this, with no solutions – mainly because I need someone to “explain like I’m 5”.

    How do I redirect one of my root domains to another root domain using htaccess?

    For example, I want to redirect mydomain.com to mydomain2.com (that is the ONLY instance where I want a redirect to happen) without redirecting mydomain.com/folder to mydomain2.com/folder

    Secondly, where do I find or place the htaccess folder?

    Any help is appreciated! Thanks!

Viewing 1 replies (of 1 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    How do I redirect one of my root domains to another root domain using htaccess?

    This should work but test it. My site is nginx and my test Apache2 setup is finicky. ??

    Try these lines at the top of your .htaccess file.

    <IfModule mod_rewrite.c>
    RewriteCond %{HTTP_HOST} mydomain\.com [NC]
    RewriteCond %{REQUEST_URI} ^/$
    RewriteRule ^(.*)$ https://mydomain2.com/ [R=301,L]
    </IfModule>

    The RewriteCond %{REQUEST_URI} ^/$ should limit that to the root only but test and make sure it’s only root and not https://mydomain.com/something-here/ too.

Viewing 1 replies (of 1 total)
  • The topic ‘301 Redirect the Root Domain Only (Not Folders) Using htaccess’ is closed to new replies.