[英].htaccess redirect rule to remove specific part from url
I have to do 301 redirection for all my url's something from 我必须对我的所有网址进行301重定向
http://www.example.com.au/website-blog/item/121-itemName
to 至
http://www.example.com.au/website-blog/itemName
Need to remove part item/(itemId)-
from all urls. 需要从所有网址中删除部分item/(itemId)-
。
I have tried 我努力了
RewriteRule ^item/[\d]+-(.*)$ /$1 [L,R=301,QSA].
Any help will be appreciated. 任何帮助将不胜感激。
Thanks. 谢谢。
Capture the item name using (.+)
and substitute accordingly. 使用(.+)
捕获项目名称并相应地替换。 Place the following rule in /.htaccess
: 将以下规则放在/.htaccess
:
RewriteRule ^website-blog/item/\d+-(.+) /website-blog/$1 [R,L]
Note: 注意:
R
to R=301
after testing 测试后将R
改为R=301
QSA
flag is not required in this case 在这种情况下,不需要QSA
标志
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.