apache rewrite map redirect to 404
My Situation:
I impleme开发者_开发问答nted an apache Rewrite Map to redirect incoming requests based on a database
RewriteEngine On
RewriteMap dbapp prg:/usr/local/somewhere/dbapp.rb
RewriteRule ^/(pattern)$ ${dbapp:$1} [R]
So far everything works fine, but I want to decide in the dbapp.rb script weather to redirect or give the client a http-status-code-404. I could just deliver a local page that doesn't exist but that doesn't seem right. I also want this to be usable on any server, and redirecting to "localhost" is also not an option ;-)
You could return -
, which essentially means: 'no rewrite', but I don't know whether that's supported in a maps/[R]
combination. Better may be to check with RewriteCond ${dbapp:$1} !^$
or something that it doesn't contain an empty string.
精彩评论