成人午夜激情影院,小视频免费在线观看,国产精品夜夜嗨,欧美日韩精品一区二区在线播放

codeigniter用.htcaccess做動態二級域名解析

2013-04-14 10:56:28來源:cnblogs作者:@胡子鍋

今天將服務器php版本升到了5.4.4,然后將之前的一個項目改用apache,動態二級轉向用.htcaccess,共享一下:

今天將服務器php版本升到了5.4.4,然后將之前的一個項目改用apache,動態二級轉向用.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>

贊助商鏈接:

主站蜘蛛池模板: 通许县| 井冈山市| 绥化市| 墨竹工卡县| 大名县| 宜兰县| 开鲁县| 无棣县| 武威市| 嘉义县| 澎湖县| 嘉黎县| 鹤峰县| 临澧县| 山西省| 泸西县| 进贤县| 方城县| 涿鹿县| 淄博市| 屏边| 岱山县| 江口县| 准格尔旗| 绍兴县| 涿鹿县| 广灵县| 河西区| 颍上县| 全南县| 伊金霍洛旗| 攀枝花市| 奉化市| 黎城县| 尼勒克县| 色达县| 侯马市| 长武县| 阳城县| 抚宁县| 和林格尔县|