我有默认控制器site.php,其中有功能。如果我想要新页面的单独控制器我怎么能调用它,因为每次默认控制器被调用我应该为它做什么设置。我是codeigniter的新手
下面是我的.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /ci_intro
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
答案 0 :(得分:0)
我不会设置RewriteBase,除非你在像Rackspace这样需要它的系统上。在那种情况下,我也会设置它/
这样它将默认为基目录。
这是我使用的.htaccess文件。这样当你去mypage.com/uri时,无论你把它放在哪里,uri就是所谓的控制器
Options +FollowSymlinks
RewriteEngine on
# On Rackspace and getting 404's? Uncoment this by removing the # :
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_rewrite.c>
RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]