ci框架apache 
     复制代码 代码如下: 
authname yousite website coming soon... //如果你想给你的网站加个权限访问 
authtype basic 
authuserfile d:/xxx/.htpasswd #如果你想设置密码访问 如何生成.htpasswd可以访问 http://www.htaccesstools.com/htpasswd-generator/ 
#authgroupfile /dev/null 
require valid-user
rewriteengine on 
rewritebase /
#removes access to the system folder by users. 
#additionally this will allow you to create a system.php controller, 
#previously this would not have been possible. 
#'system' can be replaced if you have renamed your system folder. 
rewritecond %{request_uri} ^system.* 
rewriterule ^(.*)$ /index.php?/$1 [l]
#when your application folder isn't in the system folder 
#this snippet prevents user access to the application folder 
#submitted by: fabdrol 
#rename 'application' to your applications folder name. 
rewritecond %{request_uri} ^application.* 
rewriterule ^(.*)$ /index.php?/$1 [l]
# redirect to boutique (with any trailing path) 
rewritecond %{http_host} !^www. [nc] 
rewritecond %{http_host} ^([^.]+).yousite.com(.*)$ [nc] 
rewriterule ^(.*)$ http://www.yousite.com/boutique/$1$2 [p,l]
# redirect to boutique (with any trailing path) 
rewritecond %{http_host} !^www. [nc] 
rewritecond %{http_host} ^([^.]+).yousite.com(.*)$ [nc] 
rewriterule ^(.*)$ http://www.yousite.com/boutique/%1/$1 [r=301,l]
## otherwise, force www; 
rewritecond %{http_host} ^yousite.com$ [nc] 
rewriterule ^(.*)$ http://www.yousite.com/$1 [r=301,l]
#checks to see if the user is attempting to access a valid file, 
#such as an image or css document, if this isn't true it sends the 
#request to index.php 
rewritecond %{request_filename} !-f 
rewritecond %{request_filename} !-d 
rewriterule ^(.*)$ index.php/$1 [l]
# 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
出处:cnblogs 微博:@草根小胡
   
 
   