开发者

apache rewrite map redirect to 404

开发者 https://www.devze.com 2023-01-21 00:36 出处:网络
My Situation: I impleme开发者_开发问答nted an apache Rewrite Map to redirect incoming requests based on a database

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号