Page 1 of 1
/file will read try to read /file.???
Posted: Sun Jun 19, 2005 4:22 pm
by Skara
I'm pretty sure I've seen it before, but I can't remember what it was.
First I do this:
example.com/foo
translate into
example.com/files/foo
via mod_rewrite. That part is easy.
Then I want it to see if foo.php exists. If not, look for foo.pl or something. If nothing starts with "foo." then give a 404.
This is possible, right? *crosses fingers*
Posted: Sun Jun 19, 2005 7:19 pm
by nigma
Are you particularly averse to using a php script to do this? If not you could map example.com/foo -> example.com/files/getfile.php?file=foo using mod_rewrite, then use getfile to do the rest.
This seems to be the easiest way to do it, assuming of course you don't mind/can use php.
Posted: Sun Jun 19, 2005 8:23 pm
by Skara
hmm. well. I suppose I'm just having one of those moments. Thanks.

Posted: Sun Jun 19, 2005 8:37 pm
by nigma
That's why we're here

Posted: Sun Jun 19, 2005 11:00 pm
by Skara
hmm..
Ok, I'm doing something different. Still having problems, though.
Code: Select all
RewriteRule ^files/.* / їR]
RewriteRule ^(їA-Za-z_\-]+)/?$ files/F_$1.sk їL]
Yeah, everything redirects.
Ok, so what I want to do is this... If a file in files/ is accessed directly, redirect to the main site (actually, I'd rather have an error page--that possible?). The second is my solution to the above problem. Just give all the files the same extension and be done with it.
