【发布时间】:2017-10-31 19:30:20
【问题描述】:
如何在codeigniter中编辑多个项目中的.htaccess文件和index.php文件以在其他项目中创建base url?
【问题讨论】:
标签: php .htaccess codeigniter base-url
如何在codeigniter中编辑多个项目中的.htaccess文件和index.php文件以在其他项目中创建base url?
【问题讨论】:
标签: php .htaccess codeigniter base-url
写入单个端口 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
【讨论】:
尝试阅读此文档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>
【讨论】: