Php Htaccess用于多网站codeigniter

Php Htaccess用于多网站codeigniter,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,我有一个子域网站 我试图在谷歌上搜索,但仍然没有处理我的项目 我的结构文件夹是: -public_html --subdomain_folder (this is codeigniter) ---htaccess_for_subdomain --domain_folder (this is my own projects website) ---htaccess_for_domain --htaccess_for_root 以下是我的htaccess代码: htaccess\u for\u r

我有一个子域网站

我试图在谷歌上搜索,但仍然没有处理我的项目

我的结构文件夹是:

-public_html
--subdomain_folder (this is codeigniter)
---htaccess_for_subdomain
--domain_folder (this is my own projects website)
---htaccess_for_domain
--htaccess_for_root
以下是我的htaccess代码:

htaccess\u for\u root(public\u html)

****这是我的htaccess\u for\u域****

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)/files/source/(.*)\.(gif|jpg|png|jpeg|css|js|swf|JPG)$ files/source/$2.$3 [QSA]

RewriteBase /web/ 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /domain_folder/index.php [L] 
这是\u子域的htaccess\u

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^index.php/(.*)$ /$1 [R=302,L]

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

</IfModule>

重新启动发动机
重写规则^index.php/(.*)$/$1[R=302,L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
1美元^(索引\.php | images | robots\.txt)
重写规则^(.*)$index.php?/$1[L]
当我访问我的子域(www.sub.domain.go.id)时,它总是不能正确重定向

我想要的是,当我访问www.domain.go.id时,它将重定向到domain_文件夹,当我访问www.sub.domain.go.id时,它将重定向到subdomain_文件夹


谢谢

我认为最好的解决方案是使用虚拟主机,并将每个域/子域的documentRoot设置为指向其特定文件夹

例如(apache——我想您使用apache作为web服务器)


服务器管理员administrator@localhost
服务器名www.sub.domain.go.id
DocumentRoot/path/to/your/project/public\u html/subdomain\u文件夹
选项索引跟随符号链接多视图
允许超越所有
要求所有授权
重新启动发动机
重写cond%{HTTP_HOST}^www.sub
1美元^(索引\.php | images | robots\.txt)
重写规则^(.*)$/index.php/$1[L]
对您的域执行相同的操作以指向domain_文件夹。 您可以在此链接中找到有关apache虚拟主机的更多详细信息

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^index.php/(.*)$ /$1 [R=302,L]

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

</IfModule>
<VirtualHost *:80>
    ServerAdmin administrator@localhost
    ServerName  www.sub.domain.go.id
    DocumentRoot /path/to/your/project/public_html/subdomain_folder
    <Directory /path/to/your/project/public_html/subdomain_folder/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
            RewriteEngine on
            RewriteCond %{HTTP_HOST} ^www.sub
            RewriteCond $1 !^(index\.php|images|robots\.txt)
            RewriteRule ^(.*)$ /index.php/$1 [L]
    </Directory>
</VirtualHost>