我想使用.htaccess从网址重定向或删除最后一个短语:
https://example.com/en/word1/word2/random-word-with-numbers/lang-en-GB
到
https://example.com/en/word1/word2/random-word-with-numbers
我该怎么办?我试过但不起作用:
RewriteEngine On
RewriteRule ^word2/([a-z]+)\/([0-9]+)\/(.+)$ /$1 [L,R=301]
答案 0 :(得分:1)
您可以使用:
RewriteEngine On
RewriteRule ^(.+/word2/[^/.]+)/.+$ $1 [L,R=301]