gpt4 book ai didi

.htaccess - 什么是 .htaccess 元素 REQUEST_FILENAME 和 THE_REQUEST?

转载 作者:行者123 更新时间:2023-12-03 20:15:01 29 4
gpt4 key购买 nike

%{REQUEST_FILENAME} 和 %{THE_REQUEST} 返回什么?

我只是在检查我们的 .htaccess 文件,我突然明白了,我对此知之甚少。下面的代码同时使用了两者。它有效,我只是想了解它。

#remove / at the end of URL
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/$ /$1 [L,R=301]

#remove /index.php at the end of URL
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

干杯,
标记

最佳答案

感谢艾哈迈德提供 the link .
作为对懒得点击它的任何人的快速引用,这是我所追求的...

THE_REQUEST The full HTTP request line sent by the browser to the server (e.g., "GET /index.html HTTP/1.1"). This does not include any additional headers sent by the browser. This value has not been unescaped (decoded), unlike most other variables below.

REQUEST_URI The path component of the requested URI, such as "/index.html". This notably excludes the query string which is available as as its own variable named QUERY_STRING.

REQUEST_FILENAME The full local filesystem path to the file or script matching the request, if this has already been determined by the server at the time REQUEST_FILENAME is referenced. Otherwise, such as when used in virtual host context, the same value as REQUEST_URI. Depending on the value of AcceptPathInfo, the server may have only used some leading components of the REQUEST_URI to map the request to a file.

关于.htaccess - 什么是 .htaccess 元素 REQUEST_FILENAME 和 THE_REQUEST?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17211802/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com