我有这个网址,我试图改变::
www.example.it/ mio-pezzo- product-1-url.html --> www.example.com/product-1- my-piece- url.html
www.example.com/product-1- my-piece- url.html --> www.example.it/ mio-pezzo- product-1-url.html
我试过这样的事情:
RewriteCond %{HTTP_HOST} ^(.*)\.it$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^(.*)my-piece-(.*)$ /$1mio-pezzo-$2 [L,R=301]
RewriteCond %{HTTP_HOST} ^(.*)\.com$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^(.*)mio-pezzo-(.*)$ /$1my-piece-$2 [L,R=301]
但这是结果......
www.example.it/ mio-pezzo- product-1-url.html --> www.example.com/ my-piece- product-1-url.html
www.example.com/product-1- my-piece- url.html --> www.example.it/product-1- mio-pezzo- url.html
如何在之前或之后移动它?
答案 0 :(得分:0)
只需在第一个RewriteRule上的$1
之后移动mio-pezzo-
,就像这样:
RewriteCond %{HTTP_HOST} ^(.*)\.it$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^(.*)my-piece-(.*)$ /mio-pezzo-$1$2 [L,R=301]
RewriteCond %{HTTP_HOST} ^(.*)\.com$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^(.*)mio-pezzo-(.*)$ /$1my-piece-$2 [L,R=301]