yii urlManager:如果隐藏index.php,则停止工作规则
如果我在URL中隐藏(通过.htaccess或php代码重定向)index.php name脚本,则规则将停止工作(404 error) 这意味着它在开始时工作,但现在不工作。yii urlManager:如果隐藏index.php,则停止工作规则,php,yii,Php,Yii,如果我在URL中隐藏(通过.htaccess或php代码重定向)index.php name脚本,则规则将停止工作(404 error) 这意味着它在开始时工作,但现在不工作。 我能做什么 'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>false, 'rules'=>array( 'test'=>'site/index', ), 我补充说: R
我能做什么
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'test'=>'site/index',
),
我补充说:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
一切正常,但现在我的404规则不起作用了…
(ErrorDocument 404 /404.html)
回答
如果您不想要dinamic 404页面(yii站点中的默认值/错误),请将其更改为:
RewriteRule . index.php
到RewriteRule .* /404.html
您在main.php中创建的路由规则工作正常,但您没有告诉apache超越.htaccess中的重定向规则。如果您使用的是linux,请在
/etc/apache2/sites available/
<Directory "/baepath/to/application">
AllowOverride All
#...
</Directory>
允许超越所有
#...
或者更常见的是,您可以通过为项目创建新的目录规则来创建虚拟环境 这可能有助于您在中共享重定向规则。htaccessnow my 404规则不起作用