开发者

How to redirect any /promotion/* URLs to just /* with .htaccess?

I need to redirect any requests to mysite.com/promotion/* pages to just mysite.com/*, so a few examples would be:

  • mys开发者_运维百科ite.com/promotion/some/page.html would redirect to mysite.com/some/page.html
  • mysite.com/promotion/another-page.html would redirect to mysite.com/another-page.html

How can this be done with .htaccess?


RewriteRule ^/promotion/(.*)$ /$1 [R=301]


Did it like this:

Redirect permanent /promotion/ http://www.mysite.com/

I didn't realize that it would automatically work recursively like that, but it seems to work fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜