.htaccess 将两个(或多个)url重写为一个新url
我想重写两个旧URL:.htaccess 将两个(或多个)url重写为一个新url,.htaccess,mod-rewrite,url-rewriting,.htaccess,Mod Rewrite,Url Rewriting,我想重写两个旧URL: www.example.com/Car-Systems/ford.html www.example.com/mobile/new-car-systems/ford.html 新目标url: www.newexample.com/new-car-systems/ford.html 一次重写实际上相当简单: RewriteRule ^www\.example\.com/Car-Systems/ford\.html$ /www.newexample.com/new-car-
www.example.com/Car-Systems/ford.html
www.example.com/mobile/new-car-systems/ford.html
新目标url:
www.newexample.com/new-car-systems/ford.html
一次重写实际上相当简单:
RewriteRule ^www\.example\.com/Car-Systems/ford\.html$ /www.newexample.com/new-car-systems/ford.html? [L,R=301]
但是我如何在一次重写中得到第二个呢还是每次重写都必须创建两条规则?除非您以以下方式访问这些页面:
http://some.domain.com/www.example.com/mobile/new-car-systems/ford.html
。尝试:
RewriteEngine On
RewriteRule ^(mobile/new-)?car-systems/ford.html$ /new-car-systems/ford.html [NC,L,R=301]
你说的每次重写是什么意思?