Tx,您的代码看起来不错,但我相信它只会重写 url?我已经有了新的 url,我只需要重定向到它们,这样我就不会在 google 中获得重复的页面。
我的 .htaccess 包含以下内容:
URL重写规则
重写规则 ^([a-z0-9]+)-([a-z0-9]+)(-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]* ).jpg$ /5com/img/p/$1-$2$3.jpg [L,E]
重写规则 ^([0-9]+)-([0-9]+)/([_a-zA-Z0-9-]*).jpg$ /5com/img/p/$1-$2.jpg [L ,E]
重写规则 ^([0-9]+)(-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*).jpg$ /5com/img/c/$1$2 .jpg [L,E]
RewriteRule ^lang-([az]{2})/([a-zA-Z0-9-] )/([0-9]+)-([a-zA-Z0-9-] ).html( .*)$ /5com/product.php?id_product=$3&isolang=$1$5 [L,E]
RewriteRule ^lang-([az]{2})/([0-9]+)-([a-zA-Z0-9-] ).html(. )$ /5com/product.php?id_product=$2 &isolang=$1$4 [L,E]
RewriteRule ^lang-([az]{2})/([0-9]+)-([a-zA-Z0-9-] )(. )$ /5com/category.php?id_category=$2&isolang= $1 [QSA,L,E]
重写规则 ^([a-zA-Z0-9-] )/([0-9]+)-([a-zA-Z0-9-] ).html(.*)$ /5com/product.php? id_product=$2$4 [L,E]
重写规则 ^([0-9]+)-([a-zA-Z0-9-] ).html(. )$ /5com/product.php?id_product=$1$3 [L,E]
RewriteRule ^([0-9]+)-([a-zA-Z0-9-] )(. )$ /5com/category.php?id_category=$1 [QSA,L,E]
RewriteRule ^content/([0-9]+)-([a-zA-Z0-9-] )(. )$ /5com/cms.php?id_cms=$1 [QSA,L,E]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-] )(. )$ /5com/supplier.php?id_supplier=$1$3 [QSA,L,E]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-] )(. )$ /5com/manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]
重写规则 ^lang-([az]{2})/(.*)$ /5com/$2?isolang=$1 [QSA,L,E]