How ignore any files using HHVM proxygen rewrite rules?

你。 提交于 2019-12-24 01:54:17

问题


I create a file like this example.ini:

hhvm.server.type = proxygen

hhvm.server.default_document = index.php

hhvm.virtual_host[default][rewrite_rules][common][pattern] = "(.*)"
hhvm.virtual_host[default][rewrite_rules][common][to] = "index.php/$1"
hhvm.virtual_host[default][rewrite_rules][common][qsa] = true

And calling in terminal:

$ hhvm -m server -p 9000 -d hhvm.server.source_root=/home/user/project -c example.ini

It's work fine, However I can still browse existing files that are in the same folder as the project, but what I would like is that all requests should be sent to "index.php", how can I do this?


回答1:


If you want 100% of all request to go through the rewrite rules add this:

hhvm.virtual_host[default][check_existence_before_rewrite]= false

However, unless you're building an API or something with 100% dynamic content, avoid this. Static content like text, html files, images, etc... should be allowed to be served up without having to be evaluated in your PHP code.

I'd recommend keeping all sensitive files and code (except your index.php) outside your web root. Only put static files like in this folder and of course your index.php, don't put other code in here.



来源:https://stackoverflow.com/questions/42798146/how-ignore-any-files-using-hhvm-proxygen-rewrite-rules

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!