I am using mod_jk and mod_rewrite on httpd 2.2.15. I have a rule....

RewriteCond %{REQUEST_URI} !^/video/play\.xhtml.*
RewriteRule ^/video/(.*) /video/play.xhtml?vid=$1 [PT]

I just want to rewrite something like /video/videoidhere to /video/play.xhtml?vid=videoidhere This works perfectly on my developer machine, but on production I get a 404 (generated by Jboss, not Apache).

here is the tail of access.log and rewrite.log on prod (broken). the rewrite.log is exactly the same on dev(working)

applying pattern '^/video/(.*)' to uri '/video/46279d4daf5440b2844ec831413dcc3b'
RewriteCond: input='/video/46279d4daf5440b2844ec831413dcc3b' pattern='!^/video/play\.xhtml.*' => matched
rewrite '/video/46279d4daf5440b2844ec831413dcc3b' -> '/video/play.xhtml?vid=46279d4daf5440b2844ec831413dcc3b'
split uri=/video/play.xhtml?vid=46279d4daf5440b2844ec831413dcc3b -> uri=/video/play.xhtml, args=vid=46279d4daf5440b2844ec831413dcc3b
forcing '/video/play.xhtml' to get passed through to next API URI-to-filename handler
"GET /video/46279d4daf5440b2844ec831413dcc3b HTTP/1.1" 404 420 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6"

I can access http://www.fivi.com/video/play.xhtml?vid=46279d4daf5440b2844ec831413dcc3b but not /video/46279d4daf5440b2844ec831413dcc3b

Both server are even using the EXACT same httpd.conf, and modules.

I built Apache with...

./configure --prefix /usr/local/apache2.2.15 --enable-alias --enable-rewrite --enable-cache --enable-disk_cache --enable-mem_cache --enable-ssl --enable-deflate

Thanks, Mason

----UPDATE---- -mod-jk.conf

JkWorkersFile /usr/local/apache2.2.15/conf/workers.properties
JkLogFile /var/log/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkShmFile run/jk.shm
<Location /jkstatus>
JkMount status
Order deny,allow
Deny from all
Allow from


worker.node1.ping_mode=A #As of mod_jk 1.2.27
worker.node2.ping_mode=A #As of mod_jk 1.2.27


ServerName www.fivi.com:80
Include /usr/local/apache2.2.15/conf/mod-jk.conf
NameVirtualHost *
<VirtualHost *>
  ServerName *
  DocumentRoot /usr/local/apache2/htdocs
  JkUnMount /* loadbalancer
  RedirectMatch 301 /(.*) http://www.fivi.com/$1

<VirtualHost *>
  ServerName www.fivi.com
  ServerAlias www.fivi.com images.fivi.com 
  JkMount /* loadbalancer
  JkMount / loadbalancer

[root@fivi conf]# /usr/local/apache2.2.15/bin/httpd -M

Loaded Modules:
 core_module (static)
 authn_file_module (static)
 authn_default_module (static)
 authz_host_module (static)
 authz_groupfile_module (static)
 authz_user_module (static)
 authz_default_module (static)
 auth_basic_module (static)
 cache_module (static)
 disk_cache_module (static)
 mem_cache_module (static)
 include_module (static)
 filter_module (static)
 deflate_module (static)
 log_config_module (static)
 env_module (static)
 headers_module (static)
 setenvif_module (static)
 version_module (static)
 ssl_module (static)
 mpm_prefork_module (static)
 http_module (static)
 mime_module (static)
 status_module (static)
 autoindex_module (static)
 asis_module (static)
 cgi_module (static)
 negotiation_module (static)
 dir_module (static)
 actions_module (static)
 userdir_module (static)
 alias_module (static)
 rewrite_module (static)
 so_module (static)
 jk_module (shared)
Syntax OK
  • From the above, I guess the error is not due to the rewrite rules you showed, but more in the config you use to connect Apache to JBoss. Please add those parts to the question as well.
    – earl
    Jul 22, 2010 at 14:30
  • I agree, looks like mod_rewrite is working just fine, but something under it (probably JBoss) is returning the 404.
    – Chris S
    Jul 22, 2010 at 14:37
  • thanks guys. I attached what I think are the relevant bits of the jk, httpd, etc conf files. I think this has Something to do with the virtual hosts. All config files are the same on the working and not working server, but on dev I have to comment out the "ServerName *" virtual host so it won't redirect me to www.fivi.com
    – Mason
    Jul 22, 2010 at 17:20
  • I can't comment, so I'll post here. Are you using the rewrite rule in .htaccess? This is the most common error about mod_rewrite. You need to AllowOverride FileInfo in a <Directory> block pointing to the directory where you have the rules. If not, put those rules in httpd.conf. If you keep making changes to those then you'll have to restart apache if the rules are in httpd.conf.
    – Nilesh
    Aug 10, 2010 at 13:29
  • Thanks for the answer Nilesh. However I do have these rules only in httpd.conf. I'm not using .htaccess files at all.
    – Mason
    Aug 11, 2010 at 21:48

2 Answers 2


This might be a stupid one, but I've occasionally (Debian/Ubuntu) run into a system where the ReWrite module statements weren't in the proper order, so there was a section:

<IfModule mod_rewrite.so>

which came (this was tough to trace down via all the Include statements) before apache saw the LoadModule statements.

If there's an IfModule statement, try commenting it out and see if that sorts you out.


This is old but since there is no accepted answer. I had similar problem with same re-write rules working in production but not development environment. Found this setting that was missing on development environment and adding it fixed it.

In mod_jk.conf add

JkMountCopy 'All'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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