我正在下载cakephp 3.6,当我尝试使用默认路由时,它工作得很好。但当我在/.后面加些东西时。这是我的路由器代码
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);当我请求name/时,它工作得很好,但是当我按下name/pages/10时,它给了我404错误
我的webroot htaccess文件代码在这里
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>app htaccess代码在这里
# 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>发布于 2018-05-21 10:16:47
您需要在Apache中将AllowOverride All指令添加到应用程序的文件夹中。
<Directory /var/www/your/app/dir>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>发布于 2018-05-20 08:11:27
您需要创建一个名为10.ctp的文件,并将其放入src/Template/Page中。
https://stackoverflow.com/questions/50427789
复制相似问题