Php 将域URL定向到Codeigniter控制器的正确方法
我想找出将我的域URL定向到Codeigniter索引控制器的正确方法。例如,我的域名是Php 将域URL定向到Codeigniter控制器的正确方法,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,我想找出将我的域URL定向到Codeigniter索引控制器的正确方法。例如,我的域名是www.example.com,我的CI索引控制器是www.example.com/code1/index.php/index 我应该使用.htaccess rewrite规则重定向还是使用Codeigniter url映射? 规则是什么样的 谢谢 仅使用CI路由映射无法做到这一点,您需要使用.htaccess,它可能类似于: RewriteEngine On RewriteBase / RewriteCon
www.example.com
,我的CI索引控制器是www.example.com/code1/index.php/index
我应该使用.htaccess rewrite
规则重定向还是使用Codeigniter url映射?
规则是什么样的
谢谢 仅使用CI路由映射无法做到这一点,您需要使用.htaccess,它可能类似于:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ code1/index.php/$1 [L]
已重新配置您的route.php,即
default\u controller
中的一个。这将设置应用程序的默认加载控制器/操作。您在www.example.com中是否有多个站点/应用程序?如果要重写以使其看起来不存在code1
,则需要在www.example.com/.htaccess中进行重写。如果可能的话,更简单的方法是每个应用都有一个域。