如何设置.htaccess密码保护提示的样式? [英] How can I style a .htaccess password protection promp?

查看:129
本文介绍了如何设置.htaccess密码保护提示的样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在我的Web服务器上设置了受密码保护的目录(以便存储备份等的热备份),并且想知道是否有什么方法可以设置出现以下情况时出现的密码提示的样式:用户尝试访问此页面.

I've just been messing around with setting a password protected directory on my webserver (so as to store hot copies of backups etc.) and was wondering if there's any way I may be able to style the password prompt that appears when a user attempts to access this page.

就目前而言,没有人会注意到我那漂亮的小纸条,这让我很难过.

As it stands nobody will notice my nice little note, which makes me sad.

它似乎与标准.js警报类似,但是由于无法在devtools中显示"alert"框,因此我无法找到一种方法来指定我可能可以更改的任何CSS类,只是它后面的页面:

It seems to display similarly to a standard .js alert, though I've been unable to find a way to specify any css classes I may be able to alter, as the "alert" box does not show up in devtools, just the page bahind it:

任何建议/提示将不胜感激.

Any advice / tips would be greatly appreciated.

推荐答案

您无法编辑身份验证登录框本身,每个登录浏览器的身份登录框都不一样,并且作为浏览器内部的一部分实现(例如,Chrome浏览器的一个摘要)处理登录标题的代码:

You can't edit the authentication login box itself, it's different for every browser and its implemented as part of the browser's internals (for example, a snippet of Chrome's Code dealing with the Login Title: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/app/generated_resources.grd&q=%22Authentication%20Required%22&sq=package:chromium&type=cs&l=3552).

您可以做的是创建一个自定义php登录页面(如果需要,可以使用弹出窗口)以显示:

What you can do is to create a custom php login page (with popover if you want) to display:

重定向401需要授权的页面"到自定义页面

使用htaccess通过HTML/PHP自定义登录

用html表单替换Htaccess弹出框?

这篇关于如何设置.htaccess密码保护提示的样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆