[英]Codeigniter + htaccess for index.php + subdomain not working
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/)
Locally my htaccess looks like this: 在本地我的htaccess看起来像这样:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Locally I can access: http://localhost/educonnect/profile
我可以在本地访问:
http://localhost/educonnect/profile
instead of : http://localhost/educonnect/index.php/profile
. 而不是:
http://localhost/educonnect/index.php/profile
。
But using same htaccess on my server; 但是在我的服务器上使用相同的htaccess;
I can not access: http://educonnect.digicreek.com/profile
我无法访问:
http://educonnect.digicreek.com/profile
: http://educonnect.digicreek.com/profile
However, this works: http://educonnect.digicreek.com/index.php/profile
但是,这可行:
http://educonnect.digicreek.com/index.php/profile
: http://educonnect.digicreek.com/index.php/profile
What is wrong with the routing? 路由有什么问题? Please help.
请帮忙。
Do I need to make any changes to htaccess for working with subdomains? 我需要对htaccess进行任何更改以使用子域吗?
Hi please try this in your htaccess 嗨,请在您的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]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.