早上好!)
urls不能正常工作。我有一个干净的yii2模板。我在config/web.php这个代码块中取消了注释:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],在组件的请求中添加了'baseUrl'=> '‘,
在根文件夹.htaccess中添加:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(web)
RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
RewriteRule ^css/(.*)$ web/css/$1 [L]
RewriteRule ^js/(.*)$ web/js/$1 [L]
RewriteRule ^images/(.*)$ web/images/$1 [L]
RewriteRule (.*) /web/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php在添加的web文件夹中:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php删除样式。当我删除'baseUrl'=> '‘时,它们被返回。链接/site/about主页上的销售线索,而不是指向web/site/about。在源代码中插入了css。
<link href="/assets/7fb759e5/css/bootstrap.css" rel="stylesheet">
<link href="/css/site.css" rel="stylesheet"></head>谢谢!日安))
发布于 2017-10-30 15:05:31
让我猜猜-你的漂亮卷轴坏了。
顺便说一句。不应直接设置yii\helpers\BaseUrl属性。
https://stackoverflow.com/questions/46520241
复制相似问题