我要实现
第一
诸如 fujian.abc.com  => www.abc.com/index.php?pro=fujian
第二
shop26.abc.com/about => www.abc.com/shop/index.php?uid=26&action=about这样不会冲突吗?rewrite_rule要怎么写

解决方案 »

  1.   

    1. 两者不会冲突,因为指向的直接URL不同2. 建议看一下apache中文官方文档,里面有详细的例子,需要在.htaccess文件里写URL重写规则http://www.linuxpk.com/doc/apache/
      

  2.   


    RewriteRule ^/fujian\.abc\.com/?$ www.abc.com/index.php?pro=fujian
      

  3.   

    我要实现
    第一
    诸如 fujian.abc.com => www.abc.com/index.php?pro=fujian
    第二
    shop26.abc.com/about => www.abc.com/shop/index.php?uid=26&action=about\需要服务器管理权限,否则基本没戏
    试试下面的
    RewriteEngine on
    RewriteCond   %{HTTP_HOST}                 ^fujian.abc.com$
    RewriteRule   ^(.*)$                        /index.php?pro=$1         [P,L]
    RewriteCond   %{HTTP_HOST}                 ^shop26.abc.com$
    RewriteRule   ^/about$                  /shop/index.php?uid=26&action=about [P,L]
      

  4.   


    对,RewriteCond 是重写条件,RewriteRule 重写规则。
    根据不同域名 进行不同重写
      

  5.   

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^fujian.abc.com$
    RewriteRule ^(.*)$ /index.php?pro=$1 [P,L]
    RewriteCond %{HTTP_HOST} ^shop26.abc.com$
    RewriteRule ^/about$ /shop/index.php?uid=26&action=about [P,L]支持楼上的,。基本就这样,多去看下rewrite资料  
      

  6.   

    RewriteEngine on
    RewriteRule ^http://(^\.*).abc.com$ http://www.abc.com/index.php?pro=$1 [R,L]
    RewriteRule ^http://shop(\d+).abc.com/?(^/*)/?(.*)$ www.abc.com/shop/index.php?uid=$1&action=$2&$3 [R,L]
      

  7.   

    RewriteEngine on
    RewriteRule ^http://(^\.*).abc.com http://www.abc.com/index.php?pro=$1 [R,L]
    RewriteRule ^http://shop(\d+).abc.com/?(^/*)/?(.*)$ www.abc.com/shop/index.php?uid=$1&action=$2&$3 [R,L]