我要实现
第一
诸如 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要怎么写
第一
诸如 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要怎么写
RewriteRule ^/fujian\.abc\.com/?$ www.abc.com/index.php?pro=fujian
第一
诸如 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]
对,RewriteCond 是重写条件,RewriteRule 重写规则。
根据不同域名 进行不同重写
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资料
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]
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]