@ldmitriy

Чем отличаются REQUEST_FILENAME и REQUEST_URI в htaccess?

у меня есть хост (site.local) и я обращаюсь к примеру site.local/news/list
Где тут Request_filename/request_uri?

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php


RewriteEngine on
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule . index.php
  • Вопрос задан
  • 3537 просмотров
Решения вопроса 1
@dodo512
httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rew...
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.

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

Допустим у сайта DocumentRoot "/var/www", тогда при обращении к site.local/news/list
%{REQUEST_FILENAME} -> /var/www/news/list
%{REQUEST_URI}      -> /news/list
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы