[英]Nginx - How to redirect dropping a character from URL
我有这样的旧网址:
http://www.example.com/board/here-is-the-title-t1234.html
我希望将以上内容转发到这样的新网址:
http://www.example.com/forum/here-is-the-title-1234
我需要在Nginx中使用正则表达式执行以下操作:
1)删除.html
2)删除与数字一起的“ t”字符(该字符始终出现在html扩展名的最后)。
这就是我现在所拥有的:
rewrite ^/board/(.*)\.html$ http://example.com/forum/$1 permanent;
有了以上内容,我可以删除.html部分,但是很难实现(2)-删除与数字一起的字符't'。
我希望t1234
在网址中可以变成1234,其中1234
可以是任何数字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.