Apache multiple URL to one domain redirect

For the last two day, I've been spending a lot of time to solve my problem, maybe someone can help me.

Problem: I need to redirect different url's to one tomcat webbase-dir used for artifactory. following urls should point to the tomcat/artifactory webapp:

maven-repo.example.local ; maven-repo.example.local/artifactory ; srv-example/artifactory

Where maven-repo.example.local is the dns for the server-hostname: "srv-example" I'm accessing the tomcat app through the JK_mod module. The webapp is in the ROOT directory This is what I've got so far:

<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 *: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

The webapp is working with "maven-repo.example.local", but with "maven-repo.example.local/artifactory" tomcat gives a 404 - "The requested resource () is not available." It seems that the mod_rewrite doesn't have taken any effect, even if I redirect to another page, e.g google.com

I'm testing on windows 7 with maven-repo.example.local added in the "system32/drivers/hosts" file

Thanks in advance!


Thanks a lot for your hint @PHP-Prabhu

a simple:

RedirectPermanent /artifactory /.

in the apache httpd.conf did the trick!

First, all Redirects are processed before Aliases are processed, and therefore a request that matches a Redirect or RedirectMatch will never have Aliases applied. Second, the Aliases and Redirects are processed in the order they appear in the configuration files, with the first match taking precedence

Please see this URL


Need Your Help

What is wrong with using the new operator?

c++ standards new-operator dynamic-memory-allocation

So I was recently told off on this site for using the new operator but I didn't get a response when I asked why.

Wrong media location using Django management command

python django python-imaging-library pillow

I'm downloading an image and saving it to a models image field, on a separate media app. Everything was working fine while the code was in a view but soon as I moved the code into a management comm...