0

I have configured Apache 2.2 with mod_jk and it is working fine, But in one scenario I need to rewrite from mydomain1 to mydomain2.com I have googled for this and found some solution (as in below), But It's not working.

Any help would be much appreciated., Thanks

<IfModule jk_module>
    JkWorkersFile conf/workers.properties
    JkLogFile logs/mod_jk.log
    JkLogStampFormat "[%b %d %Y - %H:%M:%S] "
    JkRequestLogFormat "%w %V %T"
    JkLogLevel info 
<VirtualHost *:80>
     ServerAdmin admin@www.mydomain1.com
     DocumentRoot "C:/apache_docs"
     ServerName www.mydomain1.com
     ErrorLog logs/www.mydomain1com_log
     CustomLog logs/www.mydomain1com_log combined

     JkMount / mydomain1
     JkMount /* mydomain1

     <IfModule mod_rewrite.c>
         RewriteEngine On
         RewriteCond %{HTTP_HOST} !^www.mydomain1.com$ [NC] RewriteRule ^(.*)$ mydomain2.com/$1 [R=301,L]
     </IfModule>
</VirtualHost>
</IfModule>
Viththal Joshi
  • 113
  • 1
  • 3
  • 11
  • I would recommend to move the question to serverfault.com as it is less of a programming and more of a webserver configuration question. – SaschaM78 Aug 31 '16 at 11:23

1 Answers1

0

Define a specific Virtualhost for the other domain and add a Redirect as follows:

Redirect / http://mydomain2.com/
Daniel Ferradal
  • 2,727
  • 1
  • 13
  • 19
  • Thanks for the response, mydomain2.com is external domain i mean it's publicly available. I think no need to add another virtualhost for this – Viththal Joshi Aug 31 '16 at 11:03