Home  >  Article  >  Backend Development  >  nginx - apk包HTTP请求强制经由PHP处理

nginx - apk包HTTP请求强制经由PHP处理

WBOY
WBOYOriginal
2016-06-06 20:15:151630browse

想将http请求,类似 http://example.com/xxxx.apk 在浏览器访问时加一些行为处理而非直接download

自己的思路是在nginx上做相应的跳转配置,但没起到作用

location / {
  rewrite ^/(.apk)$ /index.php/$1 last;
}

请教下其他思路或者处理方式

回复内容:

想将http请求,类似 http://example.com/xxxx.apk 在浏览器访问时加一些行为处理而非直接download

自己的思路是在nginx上做相应的跳转配置,但没起到作用

location / {
  rewrite ^/(.apk)$ /index.php/$1 last;
}

请教下其他思路或者处理方式

可以了,补充个答案,rewrite错位置了

location ~ \.apk{
        rewrite ^/(.*)\.apk$ /index.php/$1 last;
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn