1

I am using mod_jk for my web application and apache is configured to serve every content via Tomcat other than the static css, images and js.

I want the URL without www (abc.com) to redirect to with www subdomains (www.abc.com)

I tried escaping .htaccess via mod_jk unmount statement but .htaccess doesn't seem to work in this case.

I think the basic issue is that apache is not responding to any .htaccess rule. If I can Apache make respond to .htacess the problem should be in control.

Any idea how this can be done?

Here is my .conf for the domain

JkMount /* worker1

JkUnMount /css/* worker1

JkUnMount /images/* worker1

JkUnMount /js/* worker1

JkUnMount /.htaccess worker1

2
  • sounds like you want to bypass tomcat for abc.com and have apache redirect the user to www.abc.com - is this correct?
    – ztron
    May 21, 2012 at 17:40
  • That was correct, but I made it work via htaccess redirect. the issue was the same web root directory for apache and tomcat and a erroneous conf file. Jun 4, 2012 at 21:20

2 Answers 2

1

If I understand your issue correctly, you want to turn "example.com" into "www.example.com" via a redirect. Apache httpd ought to do this for you if you use this configuration option:

UseCanonicalName On

Note that this is the default.

I have this configuration on my server and if I hit http://example.com/index.html (obviously an example: don't consider the previous a live link), I get a 301 (Moved Permanently) response sending me to http://www.example.com/index.html.

0

You need to see apache's RewriteRule config option to do any redirects. As far as I remember, you can't do via Tomcat configuration (and you shouldn't, mod_rewrite is much much richer).

1
  • I was not able to do and I didn't even tried via tomcat. It worked via htacess after I corrected my webroot directories for apache and tomcat. Jun 4, 2012 at 21:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .