Apache 如何将任何/promotion/*URL重定向到just/*with.htaccess?
我需要将任何对mysite.com/promotion/*页面的请求重定向到mysite.com/*页面,因此以下是一些示例:Apache 如何将任何/promotion/*URL重定向到just/*with.htaccess?,apache,.htaccess,redirect,Apache,.htaccess,Redirect,我需要将任何对mysite.com/promotion/*页面的请求重定向到mysite.com/*页面,因此以下是一些示例: mysite.com/promotion/some/page.html将重定向到mysite.com/some/page.html mysite.com/promotion/other-page.html将重定向到mysite.com/other-page.html 如何使用.htaccess完成此操作?是这样做的: RewriteRule ^/promotion/
- mysite.com/promotion/some/page.html将重定向到mysite.com/some/page.html
- mysite.com/promotion/other-page.html将重定向到mysite.com/other-page.html
RewriteRule ^/promotion/(.*)$ /$1 [R=301]
Redirect permanent /promotion/ http://www.mysite.com/
我没有意识到它会像那样自动递归地工作,但它似乎工作得很好。这不就是从URL中删除促销,但仍然提供相同的内容吗?我想直接将用户从/promotion/whatever重定向到/whatever。