到目前为止,我已经使用ISAPI_REWRITE为我的ASP.NET站点上的单个页面设置了重定向。它们工作得很好(示例如下):
# Redirect
RewriteCond %{HTTP:Host} ^(?:www\.)?example\.com$
RewriteRule ^/category-1/products\.aspx /category-2/products\.aspx [I, R=301]这会将www.example.com/category-1/products.aspx重定向到www.example.com/category-2/products.aspx。
但是,现在我想重写这段代码,以便对类别1中的页面的所有请求都重定向到类别2中的相同页面,即www.example.com/category-1/allpages.aspx到www.example.com/category-1/allpages.aspx。
我如何使用RewriteRule来实现这一点?
发布于 2012-06-14 21:18:38
试试这个
# Redirect
RewriteCond %{HTTP:Host} ^(?:www\.)?example\.com$
RewriteRule ^/category-1/(.*) /category-2/$1 [I, R=301]https://stackoverflow.com/questions/11033897
复制相似问题