【问题标题】:How do I get the status code 307 instead of 200? I am using apache2 in ubuntu 18.04如何获得状态码 307 而不是 200?我在 ubuntu 18.04 中使用 apache2
【发布时间】:2020-07-08 23:43:47
【问题描述】:

下面是我的配置文件:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/kiran

    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}/index.html -f
    RewriteCond %{SCRIPT_FILENAME} !index.html
    RewriteRule ^.*$ /index.html [R=307,L]
    ErrorDocument 307 /index.html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

当我在做 curl 时,它会给我下面的状态码 -->

# curl -iL localhost
HTTP/1.1 307 Temporary Redirect
Date: Sat, 28 Mar 2020 09:36:49 GMT
Server: Apache/2.4.29 (Ubuntu)
Location: http://localhost/index.html
Last-Modified: Fri, 27 Mar 2020 15:55:07 GMT
ETag: "239-5a1d8201d0033"
Accept-Ranges: bytes
Content-Length: 569
Content-Type: text/html

HTTP/1.1 200 OK
Date: Sat, 28 Mar 2020 09:36:49 GMT
Server: Apache/2.4.29 (Ubuntu)
Last-Modified: Fri, 27 Mar 2020 15:55:07 GMT
ETag: "239-5a1d8201d0033"
Accept-Ranges: bytes
Content-Length: 569
Vary: Accept-Encoding
Content-Type: text/html

我的要求是,当我点击页面时,它会给我所有内容的 307。

【问题讨论】:

    标签: apache apache2 apache2.4 apache2.2 apache2-module


    【解决方案1】:

    看起来它正在按照您的要求进行操作。您的客户收到 307 并被重定向到您已从重写中排除的一个 URL。

    【讨论】:

      猜你喜欢
      • 2019-07-21
      • 1970-01-01
      • 2015-09-22
      • 2016-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-17
      • 1970-01-01
      相关资源
      最近更新 更多