我正试图为我的网站制定重写规则:
我处理了几个简单的一对一重定向问题。但在这种情况下我没办法。
以下是我要做的事:
www.mydomain.con/industries/accounting/<anything>应该重定向到www.mydomain.con/industries/accounting
www.mydomain.con/industries/healthcare/<anything>应该重定向到www.mydomain.con/industries/healthcare
我想出了这个:
RewriteRule ^/industries/(?:(?:accounting|healthcare)(/[-A-Za-z0-9_]*)+)$ https://%{HTTP_HOST}/$1 [R=301,L]它只是将<anything>追加到末尾,然后url变成
www.mydomain.com/industries/<anything>我不想在会计和/或医疗保健之后触发某些事情,并将其分别重定向到会计或医疗保健。
谢谢。
发布于 2016-07-20 22:29:45
您可以使用以下规则:
RewriteRule ^/?(industries/(?:accounting|healthcare))/.+$ /$1 [R=301,L,NC]不知道为什么目标URL中有resources。
https://stackoverflow.com/questions/38491875
复制相似问题