【发布时间】:2016-07-02 21:49:17
【问题描述】:
当 url 类型为时,我在 Codeigniter 中遇到问题:
example.gov.ar/news (without www and .gov)
我需要它重定向到:
www.example.gob.ar/news (with www and .gob)
但它会重定向
www.example.gob.ar/index.php/news
这是我的 htaccess 文件:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
#non-www to www
RewriteCond %{HTTP_HOST} !^www\.(.*)
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
#.gov.ar to .gob.ar
RewriteCond %{http_host} ^example.gov.ar$ [OR]
RewriteCond %{http_host} ^www.example.gov.ar$
RewriteRule ^(.*)$ http://www.example.gob.ar/$1 [R=301,L]
注意:我的配置文件有 $config['index_page'] = '';
提前致谢。
【问题讨论】:
标签: apache .htaccess codeigniter redirect codeigniter-3