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

Apache newb here.

Ultimate goal is use Apache as a reverse proxy (got that working) and append a particular value to a query string (can't get it working) via mod-rewrite.

The string in question is:

http://localhost:9089/views/JavaScriptTarget/Dashboard which I want to append ?Category=Furniture:


I have enabled the module:

#LoadModule reqtimeout_module modules/
LoadModule rewrite_module modules/
#LoadModule sed_module modules/

I have attempted to enable rewrite logging in a number of places:

<Directory />
    Options All
    AllowOverride All
    LogLevel debug rewrite:trace8
    RewriteEngine On    # Turn on the rewriting engine
    RewriteRule    ^Dashboard$    Dashboard?Category=Furniture    [NC]


# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug rewrite:trace8 both cases, I see no mentions of [rewrite] in error.log

Finally, here is the section of httpd.conf with the rewrite rule itself and the reverse proxy stuff:

<Directory />
    Options All
    AllowOverride All
    LogLevel debug rewrite:trace8
    RewriteEngine On    # Turn on the rewriting engine
    RewriteRule    ^Dashboard$    Dashboard?Category=Furniture    [NC]

#####Proxy Rule
ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all

ProxyPass / http://server8/
ProxyPassReverse / http://server8/

When I execute the string http://localhost:9089/views/JavaScriptTarget/Dashboard I am correctly redirected to http://server8/views/JavaScriptTarget/Dashboard...but ?Category=Furniture is not being appended.

Any clue what's I'm doing wrong here? I'm at wit's end. Can't even get to the point where I can get the rewrite errors to show up in logs!

I'm on 2.4.4 on Windows x64 (Win7), btw...

share|improve this question
I've never used it but I wonder if this is what the [P] mod_rewrite flag is for? – DerfK Apr 18 '13 at 23:36
I think ^Dashboard$ matches only the exact URL Dashboard. Your's might begin with a slash or even be /views/JavascriptTarget/Dashboard. Try Dashboard$ instead (means your URL ends with Dashboard). – mimipc Apr 18 '13 at 23:57
up vote 2 down vote accepted

Your RewriteRule "^Dashboard$" means that the URL string has nothing before and nothing after "Dashboard". Is that what you want? Seems like your URL is "/views/JavaScriptTarget/Dashboard".

Maybe it does not matter but I wouldn't put the RewriteRule in the configuration - on the "Directory" directive I'm no expert as I mostly use Apache for reverse proxy and I just don't end up using it.

So, all this will be ultimately proxied to your backend server "server8". Again make sure on your server8 that you have nothing that does redirect using the server's host name. You can do redirects with "/" but not with "{servername}/" if you see what I mean.

I would set the following configuration to achieve what you want.

RewriteEngine On
RewriteRule    ^/views/JavaScriptTarget/Dashboard    /views/JavaScriptTarget/Dashboard?Category=Furniture [PT]

ProxyPass / http://server8/
ProxyPassReverse / http://server8/
share|improve this answer
I would indeed advise not to put the RewriteRule in a Directory context. Just put it in the server context. RewriteRules in a Directory context are treated like rules in .htaccess files, they always result in an extra internal redirect. – Krist van Besien Apr 19 '13 at 6:02

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.