Removing index.php from Code Igniter


Removing index.php from Code Igniter

我已经为我的问题做了一个搜索,但还没有看到一个类似的。

我的服务器上有一个新安装的CI,出于安全原因,我已经将"应用程序"answers"系统"文件夹移到了public_html之外的一个名为"应用程序"的文件夹中。我试了很多方法,论坛正在使用,但似乎没有帮助。

下面是我的文件夹结构,想知道什么类型的。htaccess和这个。htaccess去哪里?

/
app (system and application folder for CI resides here)
public_html (index.php - the one which defines ENVIRONMENT, styles, other htmls and my current .htaccess resides here)

我当前的。htaccess是这样的:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$1 [PT,L]

请帮忙!感谢您的宝贵时间!

编辑目前我的网址是这样的xxx.xxx.xxx.xxx/~ app/index . php/用户/检查/id(它在共享主机上,但尚未链接到域名,因此url中的IP地址和分区)

我想实现的东西像xxx.xxx.xxx.xxx/~ app/user/检查/id当我链接我的域名时,它应该可以工作。(例如www.mydomain.com/user/check/id)

好了,我想我已经解决了这个问题。

这很可能与我拥有的"唯一"url有关。我想如果这是一个正常的域名,应该不会有这么多问题。

我的url> xxx.xxx.xxx.xxx/~app/index.php/user/check/id

目录结构保持不变>

/app(应用程序和系统目录到这里)

/public_html (index.php and .htaccess放在这里)

。Htaccess代码如下:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~app/                        << NOTE the addition
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

在config.php中设置

$config['base_url'] = 'http://xxx.xxx.xxx.xxx/~app/';
$config['index_page'] = '';

就是这样!