将域URL定向到Codeigniter控制器的正确方法

I wanted to find out what is the correct way to direct my domain URL to my Codeigniter index controller. So for example my domain name is www.example.com and my CI index controller is at www.example.com/code1/index.php/index.

Should I use .htaccess rewrite rules to redirect or Codeigniter url mapping? What would the rules look like?

Thanks!

You can't do that just by using CI route mapping, You need to use .htaccess and it could be like:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ code1/index.php/$1 [L]