Codeigniter + htaccess for index.php + subdomain无法正常工作

时间:2013-12-24 04:09:06

标签: php .htaccess codeigniter

我的生产服务器上有目录结构:

public_html/www                    # www.digicreek.com
public_html/educonnect             # educonnect.digicreek.com
public_html/educonnect/.htaccess   # Same as local(shown below)
public_html/.htaccess              # contains only one line (RewriteBase/)

本地我的htaccess看起来像这样:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

我可以在本地访问:http://localhost/educonnect/profile

而不是:http://localhost/educonnect/index.php/profile

但在我的服务器上使用相同的htaccess;

我无法访问:http://educonnect.digicreek.com/profile

但是,这有效:http://educonnect.digicreek.com/index.php/profile

路由有什么问题?请帮忙。

我是否需要对htaccess进行任何更改才能使用子域?

1 个答案:

答案 0 :(得分:1)

您好,请在您的htaccess中试试

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public_html/index.php/$1 [L,QSA]