apache重写URL
<IfModule mod_rewrite.c>RewriteEngine on
RewriteBase /
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule .* index.php
#RewriteCond %{HTTP_HOST} ^www\.ebb365\.com$
#RewriteRule ^(.+) /$1
#RewriteCond %{HTTP_HOST} [^.]+\.ebb365\.com$
#RewriteRule ^(.+) %{HTTP_HOST}$1
#RewriteRule ([^.]+)\.ebb365\.com(.*) /$1$2
#RewriteRule ^/?index\.html$ index.php
#RewriteRule ^/?(+)/(+)/(+)$ display.php?country=$1&state=$2&city=$3
RewriteCond %{HTTP_HOST} ^news\.example\.com$
#RewriteCond %{HTTP_REFERER} ^news\.example\.com/(.*)$
RewriteRule .? http://test.example.com%{REQUEST_URI}
#RewriteRule ^/?$ http://test\.example\.com
#RewriteRule .* index.php
</IfModule>
------------------------------------------------------------------------
RewriteCond :匹配的条件 ,如果匹配上了.则生效
RewriteRule :重写规则 .? http://test.example.com%{REQUEST_URI} L:表示结束
输入 http://news.example.com/test/a.html 就能重定向到 http://test.example.com/test/a.html
.? :表示整个url
如果^/?(+)/(+)/(+)$ 表示是根目录/后的url
页:
[1]