【问题标题】:How to edit htaccess file and index.php file in multiple project in codeigniter如何在codeigniter的多个项目中编辑htaccess文件和index.php文件
【发布时间】:2017-10-31 19:30:20
【问题描述】:

如何在codeigniter中编辑多个项目中的.htaccess文件和index.php文件以在其他项目中创建base url?

【问题讨论】:

    标签: php .htaccess codeigniter base-url


    【解决方案1】:

    写入单个端口 htaccess
    端口2[
    index.php //($application_folder = 'application/port2';) //设置这个路径 .htaccess//端口2
    ]
    端口3[
    index.php //($application_folder = 'application/port3';)//设置这个路径 .htaccess//port3
    ]

    application [  
            port1[  
                    config[  
                      config.php   
                        -> $config['index_page'] = ''; //set blank  
                      ]    
             ]    
             port2[   
                    config[   
                       config.php    
                            -> $config['index_page'] = ''; //set blank  
                      ]  
             ]  
               port3[   
                     config[   
                       config.php   
                            -> $config['index_page'] = ''; //set blank   
                      ]    
              ]   
               ]  
    
    //root directory is port 1 
     index.php // ($application_folder = 'application/port1';)//set this path
    

    .htaccess //port1

    【讨论】:

      【解决方案2】:

      尝试阅读此文档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> 
      

      【讨论】:

      • 我做了同样的事情。在我的应用程序文件夹中,我在根目录中有 1.Pro1 2.Pro2 和 2 个索引文件 1.index.php 2.Pro2.php Pro2 仅在我想删除 .php 的 url 中键入 Pro2.php 时运行。 Pro1还可以
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-07
      • 1970-01-01
      • 2013-11-03
      • 1970-01-01
      相关资源
      最近更新 更多