假设我有一个重写需要将url传递给一个PHP函数并检索一个值以告知新目标应该是什么?有没有办法做到这一点?从.htaccess运行PHP代码?
谢谢。
UPDATE:
由于到目前为止guys..I我仍然有麻烦,但我会告诉你我的代码:
的.htaccess
#I got the file path by echoing DOCUMENT_ROOT and added the rest.
RewriteMap fixurl prg:/var/www/vhosts/mydomain.com/httpsdocs/domain_prototype/code_base/url_handler.php
RewriteEngine On
RewriteRule (.*) ${fixurl:$1} [PT]
PHP:
set_time_limit(0); # forever program!
$keyboard = fopen("php://stdin","r");
while (1) {
$line = trim(fgets($keyboard));
print "www.google.com\n"; # <-- just test to see if working.
}
但是我得到一个500内部服务器错误我不确定在我的.htaccess或我的PHP中是否有错误?