<BR>AuthName "yousite Website Coming Soon..." //如果你想给你的网站加个权限访问 <BR>AuthType Basic <BR>AuthUserFile D:/xxx/.htpasswd #如果你想设置密码访问 如何生成.htpasswd可以访问 http://www.htaccesstools.com/htpasswd-generator/ <BR>#AuthGroupFile /dev/null <BR>require valid-user <br><br> <BR>RewriteEngine On <BR>RewriteBase / <br><br>#Removes access to the system folder by users. <BR>#Additionally this will allow you to create a System.php controller, <BR>#previously this would not have been possible. <BR>#'system' can be replaced if you have renamed your system folder. <BR>RewriteCond %{REQUEST_URI} ^system.* <BR>RewriteRule ^(.*)$ /index.php?/$1 [L] <br><br>#When your application folder isn't in the system folder <BR>#This snippet prevents user access to the application folder <BR>#Submitted by: Fabdrol <BR>#Rename 'application' to your applications folder name. <BR>RewriteCond %{REQUEST_URI} ^application.* <BR>RewriteRule ^(.*)$ /index.php?/$1 [L] <br><br><BR> <BR># Redirect to boutique (with any trailing path) <BR>RewriteCond %{HTTP_HOST} !^www. [NC] <BR>RewriteCond %{HTTP_HOST} ^([^.]+).yousite.com(.*)$ [NC] <BR>RewriteRule ^(.*)$ http://www.yousite.com/boutique/$1$2 [P,L] <BR> <br><br> <BR># Redirect to boutique (with any trailing path) <BR>RewriteCond %{HTTP_HOST} !^www. [NC] <BR>RewriteCond %{HTTP_HOST} ^([^.]+).yousite.com(.*)$ [NC] <BR>RewriteRule ^(.*)$ http://www.yousite.com/boutique/%1/$1 [R=301,L] <BR> <br><br>## Otherwise, force www; <BR>RewriteCond %{HTT<mark>@本文来源gaodaimacom搞#代%码@网-</mark><strong>搞代gaodaima码</strong>P_HOST} ^yousite.com$ [NC] <BR>RewriteRule ^(.*)$ http://www.yousite.com/$1 [R=301,L] <br><br>#Checks to see if the user is attempting to access a valid file, <BR>#such as an image or css document, if this isn't true it sends the <BR>#request to index.php <BR>RewriteCond %{REQUEST_FILENAME} !-f <BR>RewriteCond %{REQUEST_FILENAME} !-d <BR>RewriteRule ^(.*)$ index.php/$1 [L] <BR> <br><br> <BR># If we don't have mod_rewrite installed, all 404's <BR># can be sent to index.php, and everything works as normal. <BR># Submitted by: ElliotHaughin <br><br>ErrorDocument 404 /index.php <BR> <BR>
出处:cnblogs 微博:@草根小胡