htaccess的重定向除非IFRAME [英] .htaccess redirect unless in iframe

查看:195
本文介绍了htaccess的重定向除非IFRAME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建网站,我喜欢让我的客户查看正在进行的工作。目前,我做到这一点通过上传自己的网站目录,使用的.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 /

这篇关于htaccess的重定向除非IFRAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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