Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 使用Codeigniter访问子域_.htaccess_Codeigniter_Mod Rewrite - Fatal编程技术网

.htaccess 使用Codeigniter访问子域

.htaccess 使用Codeigniter访问子域,.htaccess,codeigniter,mod-rewrite,.htaccess,Codeigniter,Mod Rewrite,你能帮我使用codeigniter访问子域吗 在我的本地主机中,我有一个正在工作的htaccess RewriteEngine On RewriteBase /foldername/ RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L]

你能帮我使用codeigniter访问子域吗

在我的本地主机中,我有一个正在工作的htaccess

RewriteEngine On
RewriteBase /foldername/

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

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

RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

现在,如果我在subdomain.sample.com中移动文件,我应该在htaccess中写什么

在Config.php中

# Localhost
$config['base_url'] = 'http://localhost/Appsite/website/';
# Live
$config['base_url'] = 'http://www.sample.com/'; // if secured site use https
# Subdomain 
$config['base_url'] = 'http://subdomain.sample.com/';// if secured site use https
访问URL

<a href="<?php echo base_url('contollerName/methodName');?>"> click here</a>

访问图像

<img src="<?php echo base_url('assets/images/images.PNG');?>”>
“>
访问css

<link href="<?php echo base_url('assets/css/style.css');?>" rel="stylesheet" />
<script src="<?php echo base_url('assets/js/some_js.js');?>"></script>

Config.php中的

# Localhost
$config['base_url'] = 'http://localhost/Appsite/website/';
# Live
$config['base_url'] = 'http://www.sample.com/'; // if secured site use https
# Subdomain 
$config['base_url'] = 'http://subdomain.sample.com/';// if secured site use https
访问URL

<a href="<?php echo base_url('contollerName/methodName');?>"> click here</a>

访问图像

<img src="<?php echo base_url('assets/images/images.PNG');?>”>
“>
访问css

<link href="<?php echo base_url('assets/css/style.css');?>" rel="stylesheet" />
<script src="<?php echo base_url('assets/js/some_js.js');?>"></script>

尝试使用我的htaccess并重命名foldername时,我的css不起作用,也无法调用页面。有人能帮我吗?你更新了配置文件中的
base\u url
变量了吗?我的配置文件$配置['base_url']='';我必须把我的子域地址放在那里吗?顺便说一下,这就是我调用css文件的方式:当尝试使用htaccess并重命名foldername时,我的css不起作用,也不用于调用页面。有人能帮我吗?你更新了配置文件中的
base\u url
变量了吗?我的配置文件$配置['base_url']='';我必须把我的子域地址放在那里吗?顺便说一下,这就是我如何称呼我的css文件:我需要更改我的htaccess文件吗?谢谢。但我现在的问题是当访问我的管理页面时,它说404找不到。(例如)。你也能帮我吗。非常感谢管理员,您有单独的核心和应用程序(控制器、配置、模型等)文件夹吗?如果是,也要更新配置文件,例如,
$config['base\u url']='http://subdomain.sample.com/admin/';我只将控制器和模型分开。然后,您需要定义新的配置变量并使用它。例如,
$config['admin\u base\u url']='http://subdomain.sample.com/admin/';
在admin(all)Controller的构造函数中,加载配置,如
$this->admin\u config=$this->config->item('admin\u base\u url')
然后您可以在控制器及其视图中的任何位置调用
$this->admin\u config['admin\u base\u url']
。我需要更改我的htaccess文件吗?谢谢。但我现在的问题是当访问我的管理页面时,它说404找不到。(例如)。你也能帮我吗。非常感谢管理员,您有单独的核心和应用程序(控制器、配置、模型等)文件夹吗?如果是,也要更新配置文件,例如,
$config['base\u url']='http://subdomain.sample.com/admin/';我只将控制器和模型分开。然后,您需要定义新的配置变量并使用它。例如,
$config['admin\u base\u url']='http://subdomain.sample.com/admin/';
在admin(all)Controller的构造函数中,加载配置,如
$this->admin\u config=$this->config->item('admin\u base\u url')
然后您可以在控制器及其视图中的任何位置调用
$this->admin\u config['admin\u base\u url']