你能帮我使用codeigniter为子域提供htaccess吗?
在我的本地主机中,我有这个正在运行的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中写什么?
答案 0 :(得分:0)
在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
访问网址
<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" />
访问js
<script src="<?php echo base_url('assets/js/some_js.js');?>"></script>