[英]htaccess redirection not working in codeigniter
I have my .htaccess
code as follows : 我的
.htaccess
代码如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /annsenglishmediumschool
RewriteCond %{HTTP_HOST} ^(.+?)\.annsenglishmediumschool\.com$
RewriteRule .* http://annsenglishmediumschool.com/index.php/%1 [L]
</IfModule>
What i need is when user types as (anystring).mysite.com
should go to mysite.com/mycontroller/myaction/(anystring)
,to catch anystring in mycontroller. 我需要的是当用户输入
(anystring).mysite.com
应该转到mysite.com/mycontroller/myaction/(anystring)
,以便在mycontroller中捕获anystring。 The problem is that it now takes www
to the right as when i types www.annsenglishmediumschool.com
it goes to annsenglishmediumschool.com/index.php/www
, 问题是它现在需要
www
到右边,因为当我www.annsenglishmediumschool.com
它会转到annsenglishmediumschool.com/index.php/www
,
How to resolve this ? 怎么解决这个? Thanks.
谢谢。
EDIT : My cpanel redirects shows as follows : 编辑 :我的cpanel重定向显示如下:
Domain:(.+?).annsenglishmediumschool.com
Directory: /.*
Redirect Url :http://annsenglishmediumschool.com/index.php/%1
Any wrong with this ? 这有什么不对吗?
Just add a check to make sure it doesn't start with www
只需添加一个检查,以确保它不以
www
开头
RewriteCond %{REQUEST_URI} ^(.+?)\.annsenglishmediumschool\.com$
RewriteCond %{REQUEST_URI} !^www
RewriteRule .* http://annsenglishmediumschool.com/index.php/%1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.