假设我有一个需要将URL传递给PHP函数并检索值以确定新目标的重写?有没有办法做到这一点?
谢谢。
更新:
感谢大家迄今为止的帮助...但我仍然遇到麻烦,但我会展示我的代码:
.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代码出错了?