apache - 如何获得状态码 307 而不是 200?我在 ubuntu 18.04 中使用 apache2
问题描述
下面是我的conf文件:
<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 的所有内容。
解决方案
It looks like it's doing exactly what you asked. Your client got a 307 and was redirected the one URL you have excluded from the rewrite.
推荐阅读
- sass - scssphp 无法导入 file.sass
- flutter - 如何在上下文中结合 Flutter 中的 DropdownMenu 和 AppLocalization?
- node.js - 如何在 Node-postgres 中使用多个查询?
- c# - 简单 ASP.Net Core Razor 页面上的 HTTP 400
- react-native - React-navigation 在启动时导航
- javascript - 如何从cordova插件函数获取返回值到变量?
- jenkins - 詹金斯 - 码头工人凭证失败
- python - Python - 即使我提供了它也缺少 1 个参数
- java - 将字符串时间转换为时间对象 Java“无法在索引 0 处解析文本”
- sed - 使用 sed 删除所有以模式 b 开头的行,然后是模式 a 的行