如何在codeigniter中编辑多个项目中的htaccess文件和index.php文件

时间:2017-05-31 06:26:57

标签: php .htaccess codeigniter base-url

如何编辑codeigniter中多个项目中的.htaccess文件和index.php文件,以便在其他项目中创建基本网址?

2 个答案:

答案 0 :(得分:0)

写个别端口htaccess
   PORT2 [
         index.php //($ application_folder ='application / port2';)//设置此路径           //的.htaccess PORT2
     ]
   端口3 [
       index.php //($ application_folder ='application / port3';)//设置此路径        //的.htaccess PORT 3
     ]

PERSONAL.XLSB

.htaccess // port1

答案 1 :(得分:-1)

尝试阅读此文档Managing your Applications

然后试试这个.htaccess代码:

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /mywebsite

   # Removes access to the system folder by users.
   RewriteCond %{REQUEST_URI} ^system.*
   RewriteRule ^(.*)$ /index.php?/$1 [L]
   RewriteRule ^(.*)$ pro1.php?/$1 [L]
   RewriteRule ^(.*)$ pro2.php?/$1 [L]

   # Prevents user access to the application folder
   RewriteCond %{REQUEST_URI} ^application.*
   RewriteRule ^(.*)$ /index.php?/$1 [L]
   RewriteRule ^(.*)$ pro1.php?/$1 [L]
   RewriteRule ^(.*)$ pro2.php?/$1 [L]

   # Checks to see if the user is attempting to access a valid file,
   # such as an image or css document, if this isn't true it sends the
   # request to index.php
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?/$1 [L]
   RewriteRule ^(.*)$ pro1.php?/$1 [L]
   RewriteRule ^(.*)$ pro2.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
   ErrorDocument 404 /index.php
</IfModule>