Configurations of htaccess for Multi-Sites in Sharehost

It’s the htaccess configurations for multiple websites in sharehost. Cause sometimes you may not be able to modify apache vhosts.

 

[codesyntax lang=”apache” lines=”no”]

    Options -Indexes -MultiViews +FollowSymLinks
    Order allow,deny
    Allow from all
    DirectoryIndex index.php index.html index.htm

    RewriteEngine On
    RewriteBase /
    RewriteRule ^\.htaccess$ - [F]

    # 301 redirect, SEO
    RewriteCond %{HTTP_HOST} ^kimbs.cn [NC]
    RewriteRule ^(.*)$ http://kbs.kimbs.cn/$1 [L,R=301]
    RewriteCond %{HTTP_HOST} ^www.kimbs.cn [NC]
    RewriteRule ^(.*)$ http://kbs.kimbs.cn/$1 [L,R=301]
    #RewriteCond %{HTTP_HOST} ^www.kimbs.info [NC]
    #RewriteRule ^(.*)$ http://kimbs.info/$1 [L,R=301]

    # project "kbs"
    RewriteCond %{HTTP_HOST} ^(www.)?kimbs-local.cn$
    RewriteCond %{REQUEST_URI} !^/kbs/kbs/public/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /kbs/kbs/public/$1
    RewriteCond %{HTTP_HOST} ^(www.)?kimbs-local.cn$
    RewriteRule ^(/)?$ kbs/kbs/public/index.php [L]

    # project "duoduo"
    RewriteCond %{HTTP_HOST} ^duoduo.kimbs-local.cn$
    RewriteCond %{REQUEST_URI} !^/duoduo/blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /duoduo/blog/$1
    RewriteCond %{HTTP_HOST} ^duoduo.kimbs-local.cn$
    RewriteRule ^(/)?$ duoduo/blog/index.php [L]

    # project "creativo"
    RewriteCond %{HTTP_HOST} ^creativo.kimbs-local.cn$
    RewriteCond %{REQUEST_URI} !^/creativo/creativo/web/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /creativo/creativo/$1
    RewriteCond %{HTTP_HOST} ^creativo.kimbs-local.cn$
    RewriteRule ^(/)?$ creativo/creativo/web/index.php [L]

AddDefaultCharset UTF-8

[/codesyntax]

Posted in Apache | Tagged , | 1 Comment