htaccess redirect folder to another folder
how do I redirect http://mysite.com/folder开发者_JS百科/category-old/ to http://mysite.com/folder/category-new/?
NOTE: 1. the same 'category' exists in all folders. 2. "folder" is variable and could be "folder2" or "folder3" 3. the final folder will always be /category-new/
Use mod_rewrite
. Place something like this in .htaccess in the root directory:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/category-old/(.*)$ $1/category-new/$2 [R,L]
See http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html for more info.
精彩评论