在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
终于找到了解决方案:
sudo nano /etc/apache2/sites-available/000-default.conf
将以下行添加到`/etc/apache2/sites-available/000-default.conf
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
我需要设置Apache虚拟主机。
谢谢大家
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句