开发者

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

开发者 https://www.devze.com 2022-12-21 10:11 出处:网络
I need to redirect any requests to mysite.com/promotion/* pages to just mysite.com/*, so a few examples would be:

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

精彩评论

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