Shijin T R Shijin T R - 3 months ago 33
Apache Configuration Question

Apache redirect sub domain to main domain conditionally

I have one domain and a sub domain like and

I need to redirect all to with the following condition. to<any url> to<any url>

I have added the bellow code in my apache config file of

Redirect 301 /

Now successfully redirecting to but all other pages are not working .That are redirecting to

How to solve this issue?


The best way is to use rewrite rules.

RewriteRule ^/$ [R]
RewriteRule ^/(.+)$1 [R]

Dont forget to add the module and enable the RewriteEngine