一朵物语
标题:
Apache 301转向的写法
[打印本页]
作者:
丨一朵丶小扇
时间:
2013-12-18 21:02
标题:
Apache 301转向的写法
Apache中301转向有很多办法,下面列举其中几例:
301 Redirects using Redirect(用Redirect命令实现)
Redirect 301 /2007/webmaster/custom-phpini-with-fastcgi-on-dreamhost.html http://www.kuqin.com/dreamhost/custom-phpini-with-fastcgi-on-dreamhost.html
Redirect 301 /2007/phpbb/sending-post-form-data-with-php-curl.html http://www.kuqin.com/htaccess/sending-post-form-data-with-php-curl.html
Redirect 301 /htaccess.txt /wp-content/uploads/p/htaccess.txt
Redirect 301 /2007/webmaster/php-and-ajax-shell-console.html http://www.kuqin.com/tools/php-and-ajax-shell-console.html
Redirect 301 /2007/webmaster/custom-phpini-with-fastcgi-on-dreamhost.html http://www.kuqin.com/dreamhost/custom-phpini-with-fastcgi-on-dreamhost.html
复制代码
301 Redirects using RedirectMatch(用RedirectMatch实现)
RedirectMatch 301 ^/(.*)\.htm$ http://www.kuqin.com/$1.html
RedirectMatch 301 ^/200([0-9])/([^01])(.*)$ http://www.kuqin.com/$2$3
RedirectMatch 301 ^/category/(.*)$ http://www.kuqin.com/$1
RedirectMatch 301 ^/(.*)/htaccesselite-ultimate-htaccess-article.html(.*) http://www.kuqin.com/htaccess/htaccess.html
RedirectMatch 301 ^/(.*)\.html/1/(.*) http://www.kuqin.com/$1.html$2
RedirectMatch 301 ^/manual/(.*)$ http://www.php.net/manual/$1
RedirectMatch 301 ^/dreamweaver/(.*)$ http://www.kuqin.com/tools/$1
RedirectMatch 301 ^/z/(.*)$ http://static.kuqin.com/$1
复制代码
当然,还有通过htaccess文件来实现,比如
RewriteRule ^(x*)$ http://www.duduhi.com/$1 [L,R=301]
复制代码
欢迎光临 一朵物语 (http://bbs.yiduo.org/)
Powered by Discuz! X3.2