KirAsh4 | 11 Aug 2010 21:48
Picon

Apache Redirect

I'm hoping theres an Apache guru lurking somewhere on this list.
Here's what I'd like to do.  Consider the following setup:

www.example.com/picker.php
www.example.com/path/foo.php
www.example.com/path/bar.php
www.example.com/path/baz.php

What I'd like to do is give out either of the following URLs:
   www.example.com/path/foo
   www.example.com/foo

and have Apache internally redirect to the appropriate path/file
combination, so /path/foo.php, regardless of what case the url was
typed in (it should always be looking for lowercase file names).

There will never be a physical 'foo' or 'foo.php' file inside of the
ROOT.  So I don't have to worry about there being an actual link
there.

And lastly, for any that does not resolve (say someone typed in a non-
existing file), it should redirect to the /picker.php file.  Note,
this is not the same as setting the ErrorDocument - there is another
file handling that.

Todd A. Jacobs | 11 Aug 2010 23:43
Picon

Re: Apache Redirect

On Wed, Aug 11, 2010 at 3:48 PM, KirAsh4 <kirash4@...> wrote:
> I'm hoping theres an Apache guru lurking somewhere on this list.

I don't have an off-the-cuff answer for you, but you want mod-rewrite.
You can then design a regex or three to do what you're after. There
are simpler solutions, but none that I know of that meet all of your
other criteria.


Gmane