我正在尝试重写不存在的 URL 以使用我的 index.php 文件,同时还将 HTTP:Authorization 环境变量附加到我的脚本中。到目前为止,我一次只能让一个或另一个工作。不是都。有人可以告诉我.htaccess 中的错误在哪里吗?
RewriteEngine on
# Get HTTP authorization
RewriteCond %{HTTP:Authorization} ^Basic.*
# Append to URL
RewriteRule (.*) index.php?_auth=%{HTTP:Authorization} [QSA,L]
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule (.*) index.php?_auth=%{HTTP:Authorization} [QSA,L]