.htaccess 删除一段url并在新位置插入另一段
我正在尝试更改以下URL::.htaccess 删除一段url并在新位置插入另一段,.htaccess,url-rewriting,.htaccess,Url Rewriting,我正在尝试更改以下URL:: 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} ^
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]
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]
但这是结果
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
我怎样才能在mio pezzo之后或之前移动它?只需在mio pezzo之后移动1美元-第一条规则如下:
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]
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]