views:

18

answers:

1

I have searched on google and stackoverflow for a while, but didn't really found an answer to my question.

I want to redirect admin.domain.com to www.domain.com if there are no subdirectories or queries.

Examples that should redirect: https://admin.domain.com http://admin.domain.com https://admin.domain.com/

Examples that shouldn't redirect https://admin.domain.com/subdirectory/ https://admin.domain.com/?q=testquery

I really have no clue how to do this. I managed the trigger on subdomain, but it would also redirect if there are subdirectories.

+1  A: 

Just precede the RewriteRule that does the redirect with:

RewriteCond %{REQUEST_URI} =/
Artefacto
A standalone rule would have done that too `RewriteRule ^/$ http://.... [L]`
jmz
@jmz No, it wouldn't because of the query string.
Artefacto