简体   繁体   English

如何使codeigniter文件夹我的根文件夹?

[英]How to make codeigniter folder my root folder?

I have put the codeigniter files in a separate folder called CI_Folder. 我已将codeigniter文件放在名为CI_Folder的单独文件夹中。 This folder is in the root directory. 该文件夹位于根目录中。 index.php also resides in the root directory. index.php也驻留在根目录中。

Currently when I enter the URL www.xyz.com, index.php is displayed. 目前,当我输入URL www.xyz.com时,会显示index.php。

I want to make a website in codeigniter so that when someone enters www.xyz.com he should see the webpage which the controller is loading ie he should be redirected to the CI_Folder. 我想在codeigniter中创建一个网站,以便当有人进入www.xyz.com时,他应该看到控制器正在加载的网页,即他应该被重定向到CI_Folder。

Is this possible? 这可能吗? If yes how should I go about it? 如果是的话我应该怎么做呢?

Thanks 谢谢

Don't know why you want to do that, anyway it's as easy as: 不知道为什么要这样做,无论如何它就像:

  1. Place the codeigniter's index.php in your root directory 将codeigniter的index.php放在根目录中
  2. Open said index.php and change the $system_path and $application_folder to reflect the position of your folders. 打开index.php并更改$system_path$application_folder以反映文件夹的位置。 For example, if you place the whole "codeigniter" folder in you root, it would be: 例如,如果将整个“codeigniter”文件夹放在root中,它将是:

      $system_path = './codeigniter/system'; $application_folder = './codeigniter/application'; 

This is your folder structure now: 这是你的文件夹结构:

[webroot]
     index.php  (taken out from codeigniter package)
     codeigniter/
          application/
          system/

In index.php file of the codeigniter(in codeigniter folder) there is option to specify location and name of system folder and application folder. 在codeigniter的index.php文件中(在codeigniter文件夹中),可以选择指定system文件夹和application文件夹的位置和名称。 Specify them and use .htaccess 指定它们并使用.htaccess

I have my following rewrite options 我有以下重写选项

 <IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
 </IfModule>

<IfModule mod_rewrite.c>
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php?$1 [L]
</IfModule>

Modify as appropriate for your requirement. 根据您的要求进行修改。 I hope it helps. 我希望它有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM