我有一個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