简体   繁体   中英

How to write htaccess rule to redirect all the url's that contains the text between the slashes to a page

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.

然后试试这个:

RedirectMatch ".*\/sometext(.*?)\/" "http://www.example.com/page-to-be-redirected"

只是:

RewriteRule ^sometext/ /page.htm [R=301]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM