rewrite 二級域名

appache:

<VirtualHost *:80>

    ServerName my.hunmenghui.com

    ServerAlias    *.936880.com

    DocumentRoot "F:\wwwroot\wechat\git-wechat"

    <Directory "F:\wwwroot\wechat\git-wechat">

    AllowOverride All

    Options None

    Order allow,deny

    Allow from all

    </Directory>

    rewriteengine on

    rewritecond %{HTTP_HOST} [^.]+\.936880\.com$ 

    RewriteCond %{REQUEST_FILENAME} !^.*\.(gif|jpg|jpeg|png|swf|css|js)$

    rewriterule ^(.+) %{HTTP_HOST}$1 [C]

    rewriterule ([^.]+)\.936880\.com(.*) /index\.php?q=microsite/home&domain=$1[QSA,L]

</VirtualHost>

nginx:

    

server_name 936880.com *.936880.com;

root /home/www-data/public_html/936880.com;

set $my_rewt "";

        if ($host ~* ^(.+)\.936880\.com$ ) {

    set $my_rewt $1;

        }

if ($host ~* my.936880.com) {

            set $my_rewt "";

        }

if ($request_filename ~* ^(.*)\.(jpg|jpeg|gif|png|swf|rar|zip|css|js)$) { 

            set $my_rewt "";  

        } 

        if ($my_rewt != "") {

            rewrite ^\/$    /index.php?q=microsite/home&domain=$my_rewt last;

        }


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章