在过去的两天里,我花了很多时间来解决我的问题,也许有人可以帮助我。阿帕奇多个URL到一个域名重定向
问题:我需要将不同的url重定向到一个用于artifactory的tomcat webbase-dir。 下面的url应该指向tomcat/artifactory的webapp:
maven-repo.example.local; maven-repo.example.local/artifactory; srv-example/artifactory
其中maven-repo.example.local是服务器主机名的DNS:“srv-example” 我正在通过JK_mod模块访问tomcat应用程序。 web应用程序是在根目录 这是我到目前为止有:
<VirtualHost *:80>
#If URL contains "artifactory" strip down and redirect
RewriteEngine on
RewriteCond %{HTTP_HOST} ^\artifactory\$ [NC]
# (how can I remove 'artifactory' from the redirected parameters?)
RewriteRule ^(.*)$ http://maven-repo.example.local/$1 [R=301,L]
ServerName localhost
ErrorLog "logs/redirect-error_log"
</VirtualHost>
<VirtualHost *:80>
ServerName maven-repo.example.local
ErrorLog "logs/maven-repo.example.local-error.log"
CustomLog "logs/maven-repo.example.local-access.log" common
#calling tomcat webapp in ROOT
JkMount /* ajp13w
</VirtualHost>
web应用程序正在与“Maven的repo.example.local”,但与“Maven的repo.example.local/artifactory“tomcat提供了一个404 - ”请求的资源()不可用。“ 看来,mod_rewrite并没有采取任何效果,即使我重定向到另一个页面,例如google.com
我在Windows 7上测试与maven-repo.example.local添加在“system32/drivers/hosts“文件
在此先感谢!
此链接已损坏。 – huertanix 2015-03-03 21:13:25