最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

PHP file won't work in wordpress folder, but works in another virtual host

programmeradmin2浏览0评论

So basically I made a php file that is called with two arguments (order total and order number) and it spits out a png with an EPC QR Code (so people just scan it and their banking app fills in all the details).

This file works in an empty virtual host, but it won't work when I put it anywhere in a wordpress directory/virtual host.

Is there some setting somewhere that is keeping non-wordpress php files from executing?

So basically I made a php file that is called with two arguments (order total and order number) and it spits out a png with an EPC QR Code (so people just scan it and their banking app fills in all the details).

This file works in an empty virtual host, but it won't work when I put it anywhere in a wordpress directory/virtual host.

Is there some setting somewhere that is keeping non-wordpress php files from executing?

Share Improve this question asked Sep 1, 2019 at 8:27 Viktor GruberViktor Gruber 132 bronze badges 1
  • Welcome to WPSE. Don't forget to take the tour and check our help documentation. This is a great first question BTW. – Matthew Brown aka Lord Matt Commented Sep 2, 2019 at 1:03
Add a comment  | 

1 Answer 1

Reset to default 0

Yes. The default WordPress .htaccess file. Without edits, all calls are redirected to index.php.

Your best bet is to pass the call through WordPress as a custom plugin. This answer deals with setting up a REST endpoint. Of course, that means returning JSON which might not be exactly what you are looking for.

Another approach might be to edit the .htaccess file.

Something like this, near the top:

RewriteRule my-qr-code.php$ - [L]

This tells the server that in this case, if the file matches, we are done. That solution comes from a StackOverflow question.

发布评论

评论列表(0)

  1. 暂无评论