使用Cakephp 3路由设置路由,如下所示
$routes->post(
'/auth/login/*',
['controller' => 'WvUser', 'action' => 'login']
);
$routes->post(
'/auth/signup/*',
['controller' => 'WvUser', 'action' => 'signup']
);这在本地服务器上运行得很好,现在我在网页上收到了404错误。
这是新安装的apache,在/etc/apache2/apache2.conf中做了一些小改动。
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>尝试创建一个临时的新Cakephp项目,它也面临着类似的问题,我的项目和新的临时蛋糕框架都有类似的.htaccess文件
内部/var/www/项目
# Uncomment the following to prevent the httpoxy vulnerability
# See: https://httpoxy.org/
#<IfModule mod_headers.c>
# RequestHeader unset Proxy
#</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(\.well-known/.*)$ $1 [L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>内部/var/www/project/webroot
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>/var/www/apache2/error.log中没有错误。
发布于 2018-06-28 10:09:15
听起来你还没有在apache中启用mod重写。
对于Ubuntu:
sudo a2enmod rewrite
sudo systemctl restart apache2因为它的可选(IfModule) apache不会生成错误。
同时,也要检查是否安装了mb_string、intl和simplexml。
https://stackoverflow.com/questions/51079779
复制相似问题