简体   繁体   English

如何使用Regex在.htaccess中编写重定向规则

[英]How to write redirection rule in .htaccess using Regex

can someone tell me how to write redirection rule using regex in .htaccess file. 有人可以告诉我如何在.htaccess文件中使用正则表达式编写重定向规则。 I want 我想要

www.example.com/healthcare/practitioner/nikky.23 

to be redirectd to 重定向到

www.example.com/healthcare/practitioner/#/nikky.23

Note that last parameter after '/' ie nikky.23 can change in different cases. 请注意,在'/'之后的最后一个参数(即nikky.23)在不同情况下可以更改。 Please help. 请帮忙。

Try with RewriteRule: 尝试使用RewriteRule:

RewriteRule (healthcare/practitioner/).* $1

If you want the last parameter to be without further slashes: 如果希望最后一个参数不带斜杠:

RewriteRule (healthcare/practitioner/)[^/]*$ $1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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