我需要htaccess重写规则的帮助

时间:2020-07-31 19:45:45

标签: .htaccess

我正在尝试重定向网站的amp版本,但我需要同时更改两件事,但不能

https://example.com/dir-1/dir-2/file.htmhttps://example.com/amp/dir-1/dir-2/file.shtm

所以我需要更改扩展名和目录

我正在这样做

RewriteCond %{HTTP_USER_AGENT} (android|blackberry|googlebot\-mobile|iemobile|iphone|ipod|palmos|webos) [NC]
RewriteRule ([^/]*)\.htm$ http://www.example.com/amp/$1.shtm [L,R=302]

但它只是更改了扩展名

https://example.com/dir-1/dir-2/file.htmhttps://example.com/amp/file.shtm 没有子目录

你能帮忙吗?

0 个答案:

没有答案