如何替换:
domain.com/e-books/1234-etc
通过:
domain.com/artigos/1234-etc
我正在尝试:
RewriteRule ^e-books(\d{4}-.*)$ /artigos/(\d{4}-.*)$1 [R=301,L]
编辑:还有这个:
RewriteRule ^e-books(\d{4}-.*) /artigos/$1 [R=301,L]
最佳答案
RewriteRule ^e-books/(.+)$ /artigos/$1 [NC,R,L]
在测试之前清除浏览器的缓存。
关于regex - 在单词后用 4 个数字替换 URL 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35197973/