htaccess的重定向除非IFRAME重定向、htaccess、IFRAME

2023-09-02 00:55:05 作者:隐水酣龙

在创建网站,我喜欢让我的客户查看正在进行的工作。目前,我做到这一点通过上传自己的网站目录,使用的.htaccess密码保护的目录。但跟踪的密码,并确保该目录更新后仍然受到保护正在成为一个问题。

When creating websites, I like to let my clients view the work in progress. At the moment I do this by uploading their website to a directory, and use .htaccess to password protect that directory. But keeping track of passwords and ensuring the directory is still protected after an update is becoming an issue.

我现在已经创建了一个用户登录系统为我的客户,他们可以登录并重定向到他们的网站的preVIEW(在页面上的preview.php?C = CLIENTNAME一个iframe)。

I have now created a user login system for my clients where they can login and be redirected to a preview of their site (in an iframe on the page preview.php?c=clientName).

我看着重定向客户端站点为preVIEW页的各种途径和最简单的使用了一直的.htaccess,但这种重定向仍然影响的iframe时,该网站。

I have looked into various ways of redirecting the client site to the preview page and the easiest has been using .htaccess, but this redirect still affects the site when in an iframe.

有没有办法阻止的.htaccess重定向时,该网站是一个iframe?

Is there any way to stop the .htaccess redirect when the site is in an iframe?

推荐答案

您可以测试反对Referer的头,你真的不能依靠这一点,但它是最好的。

You could test against the "Referer" header, you can't really rely on that but it's the best possible.

例如。 http://jsfiddle.net/QmnKR/

标题之一将是的Referer:HTTP:// fiddle.jshell.net/QmnKR/show/light /