multiple folder redirection with single rule

Topics: Developer Forum, User Forum
Apr 21, 2007 at 2:03 PM
I want to redirect with this pattern:
/user/folder/app/^(/^.+)$
into
/user/folder/app/dispatch.cgi?$1

But
folder
and
app
are random folders, because I want to create a single folder for many application without having to edit the rewriter configuration.

For example, with the rule above, I can create
/user/meijin/app1/
which will automatically rewritten to
/user/meijin/app1/dispatch.fcgi (with the regex rule apply)
but I don't have to add new rule to the ionic's configuration.

How to write a single rule that can do this? Is that possible?

Thanks before.
Apr 21, 2007 at 3:44 PM
Simple

RewriteRule ^/user/(\w)/(A-Za-z0-9)/^(/^.)$ /dispatch.cgi?$2

Which basically says:

starting from /user/ capture the 2nd and 3rd "folders". This is assuming that the first folder is only going to alphanumeric.

Since "app" is what you want to capture, then we just through our $2 variable at your dispatch.cgi query string.

I'm not at my work pc to verify my rule, but think it's pretty close.
Apr 21, 2007 at 6:52 PM
the problem is that the dispatch.fcgi is not always located in root (/) directory, but in the inside of each user app directory.
Apr 21, 2007 at 9:24 PM
Edited Apr 22, 2007 at 6:10 AM
Granted...

But you stated that:
"because I want to create a single folder for many applications"

If your idea is to have one directory that handles your app and you just want "pretty" urls...this is the way to do it.

You'll have to adjust the rule accordingly. There's no way for me to know your configuration.

RewriteRule ^/user/(\w)/([A-Za-z0-9])/^(/[^.])$ /$1/$2/dispatch.cgi?$2

$1 = folder
$2 = app

I believe you should not capture "folder" because you want to keep your app in one location...why copy it to multiple locatons...this breaks the need to have Ionic in the first place.

see if that works...