且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何重定向-将网址重写为短网址

更新时间:2023-10-21 19:32:46

对于您要做什么,我还是不太清楚,但

I am a little unclear on what you are trying to do but

1

RewriteRule    ^([a-z|-]+)(\d+\.html)$    /sub-folder/topic$2    [NC,L]  

将采用第二组(仅273.html)并进行相应附加,第一组将为 之前的所有内容(topic-titles-here-t)

Would take the second group (just 273.html) and append accordingly, the first group would be everything before (topic-titles-here-t)

这是您所需要的吗?如果可以,则可以对正则表达式进行整理,我只想演示这两个组

is that what you require? If so the regex could be tidied I just wanted to demonstrate the two groups

更新-确定,根据编辑,第二组变为

update - Ok according to edit the second group just becomes

(\d{3}-\d+\.html)

如果在此示例中使用的273可以大于3个数字,如果您知道确切的话,只需修改该数字,否则请使用+

if 273 used in this example can be longer than 3 nubers if you know exact just amend that number otherwise use +