XF 2.1 Custom PHP page in add-on folder

jazz_aaf

Well-known member
I am experimenting with addon development, and I wanted to use a custom PHP file inside the addon folder. For example, the user would click on a link to the PHP file to execute some code.

The problem I am facing is whenever I click on the link pointing to the PHP file, I am getting a permission error like the following:

Code:
Forbidden

You don't have permission to access /forum/src/addons/TPost/tp.php on this server.

I have contacted the host, and they say it might be that xenForo is programmed not to allow direct access to files in the addon folders.

Any help in this issue would be appreciated.

Thank you.
 
You do not want any files under src to be directly accessable. Never.
Therefore, by default XenForo does block this via .htaccess.
 
Last edited:
Integrate the code properly into a controller with a dedicated route. You cannot access any files within src/ and internal_data/ directly.
 
Back
Top Bottom