Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ( to redirect to with www subdomains (

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

share|improve this question

migrated from May 21 '12 at 11:27

This question came from our site for professional programmers interested in conceptual questions about software development.

sounds like you want to bypass tomcat for and have apache redirect the user to - is this correct? – ztron May 21 '12 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. – Ashish Kaushik Jun 4 '12 at 21:20

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).

share|improve this answer
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. – Ashish Kaushik Jun 4 '12 at 21:21

If I understand your issue correctly, you want to turn "" into "" 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 (obviously an example: don't consider the previous a live link), I get a 301 (Moved Permanently) response sending me to

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.