<IfModule mod_rewrite.c>
RewriteEngine on
 
RewriteBase /
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule .* index.php [L,R]
 
#RewriteCond %{HTTP_HOST} ^www\.ebb365\.com$       
#RewriteRule ^(.+) /$1 [L]
 
#RewriteCond %{HTTP_HOST} [^.]+\.ebb365\.com$       
#RewriteRule ^(.+) %{HTTP_HOST}$1 [C]       
#RewriteRule ([^.]+)\.ebb365\.com(.*) /$1$2 
 
#RewriteRule ^/?index\.html$ index.php [L]
 
#RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)/([a-zA-Z_]+)$ display.php?country=$1&state=$2&city=$3 [L]
 
 
RewriteCond %{HTTP_HOST} ^news\.example\.com$
 
#RewriteCond %{HTTP_REFERER} ^news\.example\.com/(.*)$
RewriteRule .? http://test.example.com%{REQUEST_URI} [L,R]
 
#RewriteRule ^/?$ http://test\.example\.com [L,R]
#RewriteRule .* index.php [L,R]
 
</IfModule>



------------------------------------------------------------------------



RewriteCond :匹配的条件 ,如果匹配上了.则生效



RewriteRule :重写规则 .? http://test.example.com%{REQUEST_URI} [L,R]  L:表示结束





输入 http://news.example.com/test/a.html 就能重定向到 http://test.example.com/test/a.html





.? :表示整个url



如果^/?([a-zA-Z_]+)/([a-zA-Z_]+)/([a-zA-Z_]+)$  表示是根目录/后的url