Yii 应用程序中的 URL 损坏
我的 Web Yii 应用程序位于 Ubuntu 服务器的 /var/www/ 中。当我尝试更改主配置文件:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
),
隐藏index.php文件时,它说:在此服务器上找不到请求的URL(404错误)。 .htaccess 文件是:
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
并且仍然无法正常工作。
稍后编辑:解决方案是将“AllowOverride All”放在 /etc/apache2/sites-enabled/000-default 上的目录标记 /var/www/ 中,并进行 mod 重写
My web Yii application is in /var/www/ in my Ubuntu server. When I try to change the main config file:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
),
To hide the index.php file, it said: The requested URL was not found on this server(404 error). The .htaccess file is:
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
And still is not working correct.
Later edit: The solution is to put "AllowOverride All" in Directory tag /var/www/ on the /etc/apache2/sites-enabled/000-default alongside with mod rewrite
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的 .htaccess 文件中有这个规则:
尝试一下,记住您需要在 Apache 服务器中打开 Mod_rewrite。
I have this rules in my .htaccess file:
try them, remeber that you need to turn on the Mod_rewrite in you Apache server.