admin管理员组

文章数量:1414605

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.

本文标签: PHP file won39t work in wordpress folderbut works in another virtual host