0

For example my domain is www.mydomain.com and I have subdomain like subdomain.mydomain.com/action?qs1=1

Now I have changed my previous subdomain URL to www.mydomain.com/subdomain/action?qs1=1

Please let me know how to write rule in htaccess to redirect

subdomain.mydomain.com/action?qs1=1

to

www.mydomain.com/subdomain/action?qs1=1

Thanks

Sasa
  • 129
  • 2
  • 9

1 Answers1

0

This should work :

RewriteEngine on


RewriteCond %{HTTP_HOST} ^((?!www).+)\.example.com$
RewriteCond %{THE_REQUEST} /action/\?qs1=1 [NC]
RewriteRule ^ http://www.example.com/subdomain/action/ [NC,L,R]
Amit Verma
  • 40,709
  • 21
  • 93
  • 115