【问题标题】:URL Masking!With HtaccessURL 掩码!使用 Htaccess
【发布时间】:2011-12-09 00:51:54
【问题描述】:

我在这里很新,所以我有一个关于屏蔽的问题,并尝试了使用 .htaccess 的其他解决方案,但没有运气,这就是我在这里的原因。谢谢。

好的,就是这样:

  1. 我希望我的http://www.domain.com/article-tip 显示在http://www.subdomain.domain.com
  2. 表示页面内容来自:domain.com/article-tip
  3. 但是地址上面的url是:subdomain.domain.com
  4. 我将如何使用 .htaccess 来做到这一点?

这意味着我也尝试了 iframe 和框架以及 php,但我想要 .htaccess

提前致谢!

【问题讨论】:

  • 您需要利用 Apache 的 ReverseProxy 功能(除了 URL 重写之外)。

标签: .htaccess url dns subdomain masking


【解决方案1】:

在这种情况下,您可以使用mod_rewrite,网址为subdomain.domain.com/article-tip,但在php中,网址为www.domain.com/article-tip。
我认为您不能像使用 .htaccess 那样向浏览器发送动态输出

【讨论】:

    【解决方案2】:

    这应该适用于您需要让 article-tip 中的所有文件指向子域。子域也应该指向子目录。这是子目录的.htaccess。

    RewriteRule ^article-tip(.*)$ http://subdomain.domain.com [R=301,L] 
    RewriteRule ^article-tip/(.*)$ http://subdomain.domain.com/$1 [R=301,L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-25
      • 2021-05-21
      • 2023-03-29
      • 1970-01-01
      • 1970-01-01
      • 2013-01-29
      相关资源
      最近更新 更多