Codeigniter + htaccess对于index.php +子域不起作用 [英] Codeigniter + htaccess for index.php + subdomain not working

查看:38
本文介绍了Codeigniter + htaccess对于index.php +子域不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have directory structure on my production server as:

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看起来像这样:

Locally my htaccess looks like this:

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;

But using same htaccess on my server;

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

但是,此方法有效: http://educonnect.digicreek.com/index.php/profile

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

What is wrong with the routing? Please help.

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

Do I need to make any changes to htaccess for working with subdomains?

推荐答案

请在您的htaccess中尝试一下

Hi please try this in your 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]

这篇关于Codeigniter + htaccess对于index.php +子域不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆