Apache 301 跳转的两种方式,apache301


<VirtualHost *:80>
    ServerAdmin fengxuting@gmail.com
    DocumentRoot "F:\workspace\mysite"
	<Directory "F:\workspace\mysite">
		Options Indexes FollowSymLinks
		AllowOverride all
		Order Deny,Allow
		Allow from all
		satisfy all
	</Directory>
	DirectoryIndex index.php index.html index.htm
    ServerName www.mysite.dev
	ServerAlias mysite.dev
    ErrorLog "logs/mysite.dev-error.log"
    CustomLog "logs/mysite.dev-access.log" common
	RewriteEngine On
	Options +FollowSymLinks
	#这是第一种方法,但是这句是不正确的,因为301跳转不能是动态地址,也就是不能带问号。
	RedirectMatch 301 ^/test.php\?id=(.*)$ /test2.php?i2?3d=$1
	#这是第二种方法了。
	RewriteCond %{HTTP_HOST} ^mysite\.dev [NC]
	RewriteRule ^(.*)$ http://www.mysite.dev$1 [R=301,NC]
</VirtualHost>

相关内容

    暂无相关文章