绕过index.php文件

Ido*_*o_f 3 php frameworks codeigniter

我有点问题.

我目前正在为正在运行的网站添加网站.现在当前的网站是用一个我无法识别的随机框架编写的,并且由于添加相当广泛,我正在使用CodeIgniter从头开始.

现在我将我的文件添加到服务器下,并将文件名称为'business.php'.通过'www.mysite.com/business.php'调用我的页面效果很好但是当我尝试使用像'www.site.co/business.php/myController'这样的CI调用来调用控制器时,我收到错误通过服务器默认调用index.php文件,这有另一种方法来处理URI.

任何人都可以告诉我,我该怎么做才能绕过原始文件?

tnx的时间和帮助.

Mad*_*ota 5

在项目根目录中创建.htaccess文件并粘贴此...

DirectoryIndex index.php
RewriteEngine On
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
Run Code Online (Sandbox Code Playgroud)

接下来转到"config/config.php"

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';
Run Code Online (Sandbox Code Playgroud)

将此更改为

$config['index_page'] = '';
Run Code Online (Sandbox Code Playgroud)

就这样...

你的网址:

http://www.stackoverflow.com/index.php/my_controller/my_function/param1/param2
Run Code Online (Sandbox Code Playgroud)

http://www.stackoverflow.com/my_controller/my_function/param1/param2
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助!!