简体   繁体   中英

Manually initiate authentication using .htaccess

I'm trying to create an UnderConstruction page for my new site.

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.

Currently, I have an .htaccess setup to authenticate on any access to the site. 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.

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.

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).

I'm working on an apache with php5 on a linux server.

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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