Writing .htaccess file with php to update AJAX allow from urls

你说的曾经没有我的故事 提交于 2020-01-05 04:25:32

问题


I'm working to create some embeds for articles on a site. The embeds call a Javascript file that figures out which article to grab from my site and makes an AJAX call to the appropriate JSON file to grab the article, parse it and then display it.

I also have a member system going which will allow people to sign up for an account telling me what site they will use the embeds on.

What I want to do is have an .htaccess file on the root folder of these JSON files so that only approved members can use the embed which makes AJAX calls to these JSON files.

The .htaccess file will have a list of allow urls that can AJAX to the folder. The thing is it will have to be updated as members are added and deleted.

What's the best way to constantly update this .htaccess file with PHP?

Many thanks in advance!


回答1:


why dont make your checks with php and hand out the files with php? its very bad practice to create rule for every single member and also will slow down the server



来源:https://stackoverflow.com/questions/39193137/writing-htaccess-file-with-php-to-update-ajax-allow-from-urls

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