I’m having trouble redirecting my domain to a subdomain.

My domain is www.example.com and I want all traffic to go to aa.example.com

I tried the following code in htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www?.example.com$ [NC]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^index.php?$ http://new.example.com [R=301,L]

But then this happens:

example.com/aa.example.com

which obviously returns a ‘page not found’. I’ve had a look at similar questions but I’m inexperienced with these things and can’t solve the problem.

Read more here: Redirecting domain to subdomain with htaccess


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: