扫码关注官方订阅号
RewriteRule ^(.*\.(png|jpg))/(.*)$ image.php?url=$1¶m=$3 [L]
认证高级PHP讲师
这个应该是 .htaccess 用的代码,主要是 Apache 在用,NGINX不能直接用。NGINX改写规则挺麻烦的,一般都是写到nginx/conf.d/default.conf中。
nginx/conf.d/default.conf
Nginx rewrite 文档:http://nginx.org/en/docs/http...
(这也是为何我是Apache党,很多东西还是太方便了)
网址:http://111.com/abc.png?param=1 转发到:http://222.com/image.php?url=/abc.png¶m=1 location ~* \.(png|jpg) { rewrite (.*\.(png|jpg)) http://baidu.com/image.php?url=$1 break; }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
这个应该是 .htaccess 用的代码,主要是 Apache 在用,NGINX不能直接用。
NGINX改写规则挺麻烦的,一般都是写到
nginx/conf.d/default.conf中。Nginx rewrite 文档:http://nginx.org/en/docs/http...
(这也是为何我是Apache党,很多东西还是太方便了)