0

I want to run a file/script (that sends me an email notification) when a file matches a rewrite/redirect pattern in htaccess.

Can I do it without rewriting to the script file itself then that file performs a simple redirect?

Eg.

RewriteRule ^location/of/old/script/(.*) /my/new/location/$1
Call /notify.php?file=$1
4

1 回答 1

0

Mod_rewrite can't call external programs outside of the RewriteMap's prg map type, but that's not going to help you unless you write a script to specifically handle rewrite map calls. You're best bet is to rewrite to notify.php, and from there, load the /my/new/location/ file:

RewriteRule ^location/of/old/script/(.*)$ /notify.php?file=$1 [L]

Then in the notify.php script:

readfile(_$GET['file']);
于 2013-10-01T02:49:37.880 回答