# BEGIN WordPress RewriteEngineon # # Unless you have set a different RewriteBase preceding this # point, you may delete or comment-out the following # RewriteBase directive: RewriteBase / # #Start 301 redirect RewriteCond%{HTTP_HOST} ^rockscrusher.com [NC] RewriteRule ^(.*)$ http://www.rockscrusher.com/$1 [L,R=301] RewriteCond%{THE_REQUEST} ^.*/index.html RewriteRule ^(.*)index.html$ http://www.rockscrusher.com/$1 [R=301,L] RewriteRule ^case/rock-crusher$ http://www.rockscrusher.com/case/mining-crusher/$1 [R=301,L] RewriteRule ^case/rock-crusher/(.*)$ http://www.rockscrusher.com/case/mining-crusher/$1 [R=301,L] #End 301 redirect # if this request is for "/" or has already been rewritten to WP RewriteCond $1 ^(index\.php)?$ [OR] # or if request is for image, css, or js file RewriteCond $1 \.(gif|jpg|css|js|ico)$ [NC,OR] # or if URL resolves to existing file RewriteCond%{REQUEST_FILENAME} -f [OR] # or if URL resolves to existing directory RewriteCond%{REQUEST_FILENAME} -d # then skip the rewrite to WP RewriteRule ^(.*)$ - [S=1] # else rewrite the request to WP RewriteRule . /case/index.php [L] # END wordpress
附:PHP 下的301 重定向
1 2
<?phpHeader( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.rockscrusher.com" );?>