继续在 Ubuntu 16.04 LTS 上遇到错误。
404 Not Found
The requested URL /application/templates was not found on this server.
Apache/2.4.18 (Ubuntu) Server at 00.0.0.00 Port 80
在 error.log 中显示:
No such file or directory in /var/www/html/aplication/api.php on line 228
以下是我目前的重写规则:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
#RewriteRule ^([a-z]+)\/?$ $1.php [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
#RewriteRule ^([a-z]+)\/?$ $1.html [NC]
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?a=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?a=$1
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?a=$1&b=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?a=$1&b=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?a=$1&b=$2&c=$3
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?a=$1&b=$2&c=$3
</IfModule>
tail -f var/log/apache2/error.log 的输出
[Thu Jun 14 10:30:50.138694 2018] [:error] [pid 7150] [client 172.29.9.57:38776] PHP Stack trace:
[Thu Jun 14 10:30:50.138704 2018] [:error] [pid 7150] [client 172.29.9.57:38776] PHP 1. {main}() /var/www/html/TestCopy_Report1/index.php:0
查找的输出:
sudo find / -iname api.php
find: ‘/run/user/1000/gvfs’: Permission denied
/var/www/html/application/api.php
/var/www/html/test1/api.php
/var/www/html/test2/api.php
/var/www/html/test3/api.php
/var/www/html/test4/api.php
/var/www/html/test5/api.php