htaccess的不工作的codeigniter子域和放大器;目录中安装放大器、工作、目录中、htaccess

2023-09-02 01:08:41 作者:趁你病,要你命

我想要的目录,这也是一个子站点下安装CI。因此,我的基本URL看起来像 http://subdomain.domain.com/ci/

I am trying to install CI under a directory which is also on a subdomain. So my base url would look like http://subdomain.domain.com/ci/

下面的htaccess工作正常域的根,但不是在目录中,浏览器说,有重定向循环错误。

The following htaccess works fine on root of domain but not on directory, the browser says there is a redirect loop error.

下面是我的code:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^sub.domain.com/ci/$
RewriteRule ^(.*)$ http://sub.domain.com/ci/$1 [L,R=301]

RewriteCond $1 !^(index.php|assets)
RewriteRule ^(.*)$ /index.php?/$1 [L]

我不是很熟练与mod-rewrite,任何帮助,将AP preciated!谢谢!

I am not very skilled with mod rewrite, any help would be appreciated! Thank you!

推荐答案

在你的/ CI目录中的htaccess的应该是如下:

Inside your /ci directory your htaccess should be as follows

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f # this means if the requested file name doesnt exist 
RewriteCond %{REQUEST_FILENAME} !-d # this means if the requested directory doesnt exist 
RewriteRule ^(.*)$ index.php [L]

根据这应该是足够您的上述评论

Based on your above comments that should be sufficient