我有一个PHP脚本位于http://sb1.dev.codeanywhere.net/~a70097sb/hc/onlinestatus/image.php
需要两个GET
变量:ign
和style
。我的.htaccess
文件与image.php
位于同一个目录中。如何使用.htaccess将图像重写为PHP脚本?
我希望将表格http://sb1.dev.codeanywhere.net/~a70097sb/hc/onlinestatus/{style}/{ign}.png
的请求重写为http://sb1.dev.codeanywhere.net/~a70097sb/hc/onlinestatus/image.php?style={style}&ign={ign}
。我该怎么做,因为我没有使用mod_rewrite的经验,并且无法使用我在Google上找到的任何教程来运行它。
试过,但它没有工作,我只是得到一个404页:
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteRule ^([^.]*)/([^.]*)\.png$ image.php?style=$1&ign=$2 [L,NC]
两个答案似乎都没有工作。看到我更新的问题,我包括了实际的网站,因为我认为它可能与子域有关。我在这些路径的开头添加了〜〜a70097sb /',但它仍然不起作用。 – 2012-07-10 02:07:18
@DC_看到我的更新 - 对不起,我错过了关于您的.htaccess在'image.php'目录中的部分。 – 2012-07-10 02:09:47
仍然不工作:http://sb1.dev.codeanywhere.net/~a70097sb/hc/onlinestatus/test/test.png – 2012-07-10 02:12:17