简体   繁体   English

允许php访问htaccess保护的代码

[英]allow php to access htaccess protected codes

I try to reuse codes from my back-end across ajax, written in OOP pattern and protected witch htaccess . 我尝试从后端跨ajax重用以OOP模式编写并保护htaccess的代码。 My problem is that I want to avoid the authentication popup for the front-end user when page is requested. 我的问题是,当请求页面时,我想避免前端用户的身份验证弹出窗口。

Structue 结构

-admin
  -controllers
   --oneofmycontroller.php
  -models
    --oneofmymodel.php
  -views
  -index.php
  -.htaccess

-fontend
  -myphpfiles
    method.php// and here I try to access one of my controller to fetch datas

and the way how am I try to access 以及我尝试访问的方式

like /admin?controller=oneofmycontroller&action=methodToCall

the front-end codes are not yet OOP compatible 前端代码尚不兼容OOP

Scenario 情境

vistor->access public page->public page calls back-end script across ajax to fetch data(which is htacess protected) -> if visitor is not logged-in sees a pop-up (and this one I would like to avoid but on the same time keep my back-end safe)

As /admin is protected by htaccess, you can not request it from outside. 由于/ admin受htaccess保护,因此您不能从外部请求它。 You can request a file in /frontend and include your controller from there. 您可以在/ frontend中请求文件,并从那里包含您的控制器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM