I want to redirect only my root to another url, but maintain all the /sub/directories where they belong (and redirect)
example:
mysite.com/1 redirects to somewhere mysite.com/admin opens a page
i want mysite.com/ to redirect to mysecondsite.com and only this with a 301 redirect using htaccess
RewriteCond %{HTTP_HOST} ^mysite\.com$ [NC]to ensure the match was for the exact host – jaygooby Jun 23 '14 at 13:18RewriteRulepattern (as in @DaveForgac's answer), instead of using an additional condition to check theREQUEST_URIserver variable. – MrWhite Jul 29 '18 at 17:38RewriteCond %{QUERY_STRING} !my_parameter= https://stackoverflow.com/questions/12134384/htaccess-to-redirect-one-domain-to-another-only-if-no-parameters-are-provided – Ralf Oct 27 '23 at 12:45