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

Possible Duplicate:
Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask?

I am looking for a recipe for a mod_rewrite rule that will accomplish this:

MOD_REWRITE recipe: /agencyname TO /appname/login.jsp?a=agencyname

share|improve this question

marked as duplicate by EEAA, Chris S, jscott, coredump, Chopper3 Apr 26 '11 at 20:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I am going to have to re-enter this one because it doesn't answer my question and neither does the reference as a dupe. – djangofan Apr 27 '11 at 18:03
RewriteEngine On
RewriteRule ^/(.*)        /appname/login.jsp?a=$1

should be your solution.

share|improve this answer
This didn't work for me. I created a directory called "appname" off the root of my site and then tried your rule with localhost/appname but all it does is show me the contents of the "appname" directory. The rule doesn't fire. – djangofan Apr 27 '11 at 17:47
This doesn't answer my question since it doesnt cover the case if someone entered /appname/xxxx as the URI. in that case i would still only want to pass "appname". – djangofan Apr 27 '11 at 18:05
@djangofan well that requirement wasn't in your question. We're not mind readers. And yes, @Stefan's solution is correct. There may be something wrong with how you're testing it, though. – EEAA Apr 28 '11 at 3:23

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