RewriteMap MapType dbd 的问题
继续这里的另一个讨论:
我被要求开始另一个问题。
我将其添加到我的 httpd.conf 文件中:
DBDriver mysql
DBDParams "host=*****,user=*****,pass=*****,dbname=*****"
RewriteEngine On
RewriteMap hrci "dbd:SELECT title FROM challenges WHERE id = %s"
当我尝试重新启动 Apache 时,出现此错误:
RewriteMap: file for map hrci not found:/dh/apache2/apache2-ps54462/dbd:SELECT title FROM challenges WHERE id = %s
看起来它完全忽略了 dbd 部分并尝试将整个内容作为文件名读取。我真的不知道我做错了什么。
更新
我尝试简化这一点,只使用地图的直接文本文件:
RewriteMap hrci txt:/home/username/rewrite.txt
根目录中有一个文本文件,其中仅包含以下内容:
232 The+Pillar+of+Autumn+LASO
最后,我有我的重写规则:
RewriteRule ^ch([0-9]{1,4})(/)?$ http://reachchallenges.infectionist.com/challenge/$1/${hrci:$1} [R= 301,L]
因此访问路径 ch232
应重定向到/challenge/232/The+Pillar+of+Autumn+LASO
,但它只是重定向到 /challenge/232/
,没有标题。我到底做错了什么?!?
Continuing from another discussion here:
Where I was asked to start another question.
I added this to my httpd.conf file:
DBDriver mysql
DBDParams "host=*****,user=*****,pass=*****,dbname=*****"
RewriteEngine On
RewriteMap hrci "dbd:SELECT title FROM challenges WHERE id = %s"
When I tried to restart Apache I got this error:
RewriteMap: file for map hrci not found:/dh/apache2/apache2-ps54462/dbd:SELECT title FROM challenges WHERE id = %s
It looks like it's completely ignoring the dbd
part and trying to read the whole thing as a file name. I really don't know what I'm doing wrong.
UPDATE
I tried simplifying this and just using a straight text file for the map:
RewriteMap hrci txt:/home/username/rewrite.txt
There is a text file in the root directory that contains simply this:
232 The+Pillar+of+Autumn+LASO
And finally, I have my rewrite rule:
RewriteRule ^ch([0-9]{1,4})(/)?$ http://reachchallenges.infectionist.com/challenge/$1/${hrci:$1} [R=301,L]
So visiting the path ch232
should redirect to /challenge/232/The+Pillar+of+Autumn+LASO
, but instead it just redirects to /challenge/232/
, no title. What the heck am I doing wrong?!?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现 RewriteMap 中的 dbd 部分不起作用(至少对我来说)的原因是它应该只能在 apache 2.3+ 上工作。对于我的apache2.2来说,它不起作用。
I found out that the reason why the dbd part in the RewriteMap is not working (at least for me) is that it should be working only from apache 2.3+. For my apache2.2, it does not work.