[英]htaccess redirect 301 without a separator
網址末尾有數字,沒有任何分隔符
給定URL像
example.com/productdetails/product-flowers123
需要重定向
example.com/productdetails/product-flowers--123
我可以用.htaccess做到嗎
我已經嘗試過: RedirectMatch 301 ^/productdetails/([A-Za-z]+)$([0-9]+)$ /productdetails/$1--$2
但是它沒有用。
您可以改用以下規則:
RedirectMatch 301 ^/(productdetails/.*?[a-zA-Z])([0-9]+)/?$ /$1-$2
在測試此更改之前,請確保使用新的瀏覽器或清除瀏覽器緩存。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.