如何在 Yii 框架中删除 index.php [英] How to remove index.php in Yii Framework

查看:18
本文介绍了如何在 Yii 框架中删除 index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我是 Yii 框架的新手.我想从我的网址中删除 index.php.按照 yii 文档,当我将重写引擎代码放入我的 .htaccess 文件并在我的 config/main.php 文件中将 showScriptName 设置为 false 时,我收到 500 内部服务器错误.我的 .htaccess 文件位于我的应用程序的根文件夹中.告诉我哪里做错了

Hey guyz i am a newbie in Yii framework. I want to remove the index.php from my urls. Following the yii documentation when i put the rewrite engine code in my .htaccess file and setting showScriptName to false in my config/main.php file i get the 500 internal server error. My .htaccess file is located in root folder of my application. Tell me where i am doing wrong

更新:

这是我的 .htaccess 文件中的代码:

This is the code in my .htaccess file:

# 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

推荐答案

试试这个

这里有一个很好的描述

http://www.yiiframework.com/doc/guide/1.1/en/topics.url#hiding-x-23x

这篇关于如何在 Yii 框架中删除 index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆