How to write htaccess rule to redirect all the url

2019-09-21 19:00发布

How to write htaccess rule to redirect all the url's that contains the sometext word between the slashes

Ex:

https://www.example.com/sometext/
https://www.example.com/sometext/name.php
https://www.example.com/sometext/sometext/.. 
https://www.example.com/sometext/../../name.php  

ALL THESE need to redirect to a single page.

Thanks for help in advance.

2条回答
贼婆χ
2楼-- · 2019-09-21 19:03

Just:

RewriteRule ^sometext/ /page.htm [R=301]
查看更多
We Are One
3楼-- · 2019-09-21 19:30

Try this then:

RedirectMatch ".*\/sometext(.*?)\/" "http://www.example.com/page-to-be-redirected"
查看更多
登录 后发表回答