我有一個 apache 問題,給我一個“未找到”錯誤。
設想:
我有一個形式的 url --> 10.17.10.19/webapps/api/index.php?url=auth
我想重寫表單中的url --> 10.17.10.19/webapps/api/auth
我正在使用 Ubuntu 20.04 apache2
虛擬主機:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
訪問:
RewriteEngine On
Options All -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
apache.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes
# FollowSymLinks
# AllowOverride None
Require all granted
</Directory>
#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>
請幫我糾正條件以識別引數
uj5u.com熱心網友回復:
我找到了我需要啟用標頭的答案,以便 htaccess 可以作業
ae2enmod header
https://httpd.apache.org/docs/2.4/mod/
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/520171.html
上一篇:正則運算式從url中洗掉相對路徑
