简体   繁体   English

使用.htaccess手动启动身份验证

[英]Manually initiate authentication using .htaccess

I'm trying to create an UnderConstruction page for my new site. 我正在尝试为我的新站点创建一个UnderConstruction页面。

I would like to retain all the core files (files that are part of the site) without modification while I try to implement this. 在尝试实现此功能时,我想保留所有核心文件(属于网站一部分的文件)而无需修改。 This includes leaving the index.php intact. 这包括保留index.php不变。

Currently, I have an .htaccess setup to authenticate on any access to the site. 当前,我有一个.htaccess设置来验证对该网站的任何访问。 I want to redirect any user accessing any page (at least the index.php) to an UnderConstruction page and then leave a link there which my dev team could use to authenticate themselves and continue using the site as usual. 我想将访问任何页面(至少index.php)的所有用户重定向到UnderConstruction页面,然后在其中保留一个链接,我的开发团队可以使用该链接对自己进行身份验证并继续照常使用该网站。

But in order to leave the core files intact, I would have to initiate the htaccess type authentication & then in index.php (assuming that index.php is excluded from the cuth) check the auth status. 但是,为了使核心文件完整无缺,我将必须启动htaccess类型的身份验证,然后在index.php中(假设从cuth中排除了index.php)检查auth状态。

I tried to play around with $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] but these (as I understand) requires me to manually implement the authentication scheme (ie checking against a list of username & passwords). 我试图玩$_SERVER['PHP_AUTH_USER']$_SERVER['PHP_AUTH_PW']但是这些(据我了解)要求我手动实现身份验证方案(即,检查用户名和密码列表)。

I'm working on an apache with php5 on a linux server. 我正在使用Linux服务器上的php5在Apache上工作。

Any ideas? 有任何想法吗?

You should just mirror the dev version of the site to a subdomain like dev.mysite.com and then keep the under construction stuff on the main domain. 您应该将站点的开发版本镜像到dev.mysite.com之类的子域,然后将正在建设的内容保留在主域中。 This way you can secure the dev domain and still keep your under construction page going and the two will be isolated. 这样,您可以保护开发域,并仍然保持正在构建的页面前进,而这两个将被隔离。

将它放在htacces上,以便锁定每个文件

Redirect /file.extension http://www.uroot.com/index.php

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

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