如何在 Yii 框架中删除 index.php

2022-01-04 00:00:00 url php yii

嘿,我是 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

相关文章