Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 将两个(或多个)url重写为一个新url_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

.htaccess 将两个(或多个)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-

我想重写两个旧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-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]
你说的每次重写是什么意思?