【问题标题】:Redirect on the basis of referer HTTP_REFERER htaccess基于referer HTTP_REFERER htaccess 的重定向
【发布时间】:2011-03-01 06:54:31
【问题描述】:

我有一个问题,我想根据引用 url 中的子字符串重定向用户,我如何使用 htaccess 来完成?

  1. 用户在http://example.com/aqeel/videos/
  2. 以上页面有超链接http://demo.example.com/
  3. 当用户到达http://demo.example.com/时,我希望他被重定向到http://demo.example.com/login/aqeel/,这里aqeel是从步骤1 URL的htaccess中的referer url捕获的子字符串。

提前致谢,

【问题讨论】:

    标签: .htaccess http-referer


    【解决方案1】:

    您可以使用下面的代码来完成这项工作:

    RewriteCond %{HTTP_REFERER} http\:\/\/example.com/([a-z]+)/videos/
    RewriteRule (.*)$ /login/%1/
    

    我在我的域上尝试过.. 它有效...希望也能与您一起工作...:)

    【讨论】:

      猜你喜欢
      • 2012-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多