apache+codeigniter 通过.htcaccess做动态二级域名解析
authname "yousite website coming soon..." //如果你想给你的网站加个权限访问
authtype basic
authuserfile d:/xxx/.htpasswd #如果你想设置密码访问 如何生成.htpasswd可以访问 http://www.htaccesstools.com/htpasswd-generator/
#authgroupfile /dev/null
require valid-user
<ifmodule mod_rewrite.c>
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]
<ifmodule mod_proxy.c>
# 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]
</ifmodule>
<ifmodule !mod_proxy.c>
# 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]
</ifmodule>
## 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]
</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>
出处:cnblogs 微博:@草根小胡
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
-
-
-
-
-
管理后台无限级菜单
管理后台菜单遍历很久就想做一个通用的管理后台出来,一直太懒没做,今天开始粗略搞了一下,只是先把框架搭建好,菜单栏...
[阅读全文]
-
桥接模式学习总结
桥接模式引言假如一个系统需要加入报表模块,主要的开发点是数据的获取和报表的显示方式。数据的获取可能是从系统数据库...
[阅读全文]
-
网友评论