Forum Moderators: phranque
In case you haven't visited my last post, I'm using the following code,
RewriteCond %{THE_REQUEST} ^GET\ /test\.asp\?meta=([a-z-]+)\ HTTP
RewriteRule ^test\.asp$ http://localhost/${level1-1:%1}? [R=301] RewriteRule ^([a-z-]+)/?$ test.asp?meta=/${level1:$1 , which executes an external rewrite from test.asp?meta=ho to /horses/, then internally rewrites the URLS, so that when /horses/ is requested, the content within the file test.asp?meta=ho is executed.
What I'd now like to do is to throw a 404 on the internal rewrite (it makes sense to me for the 301 to be executed no matter what) if the mapfile entry that is being requested, doesn't exist.
From my initial investigation, I assume the correct directive to use in this instance is RewriteCond; upon looking into the documentaion, it states that RewriteMap expansions can be used, but I can see no more information on it - I assume this is what I need? I am however, unsure as to how to the syntax for such a rule.
Could someone please give me a few pointers?
Regards
James
Thinking more about the original issue, I can see something along the lines of
RewriteCond somevariable !-F
Where the RewriteCond pattern does *not* match the variable as a pathname and tests whether or not it exists, and is a regular file.
I'm not even sure if that would be correct, but that's how I think it could work.
I'm still looking for a few pointers though :)
Jim
Jim