【问题标题】:Can someone explain this rewrite in plain english有人可以用简单的英语解释这个重写吗
【发布时间】:2019-02-15 21:56:04
【问题描述】:

我有一个域,并且也托管了多个子域。该环境是由提供商设置的非常准系统,我可以完全访问以进行我认为合适的任何更改。我需要了解这个重写的东西在做什么,这样我就可以了解和解决发送到 /homepage 的所有内容的问题,而不管人们在栏中输入的地址是什么。

RewiteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/homepage

理想的结果是用户输入http://domain.tld 并获得https://domain.tld,或者他们输入https://domain.tld 并获得他们输入的内容。或输入http://sub.domain.tld 并获取https://sub.domain.tld

理想情况下,只有 domain.tld 和 https://domain.tld 应该发送到 https://domain.tld/homepage

【问题讨论】:

    标签: .htaccess apache2 ubuntu-14.04


    【解决方案1】:
    RewriteEngine On
    #This will enable the Rewrite capabilities
    
    RewriteCond %{HTTPS} off 
    #This checks to make sure the connection is not already HTTPS
    
    RewriteRule (.*) https://%{HTTP_HOST}/homepage 
    #This will send all requests to specified address, in this case homepage
    

    RewriteCond 定义了重写发生的条件。换句话说就是 RewriteRule 的执行

    查看此link 了解更多信息

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-17
      • 1970-01-01
      • 2011-04-18
      • 2011-03-17
      • 1970-01-01
      相关资源
      最近更新 更多