请帮助在.htaccess文件中实现以下目标
请求网址
htpps://www.examplesite.com/folder/file/amp/
要检查的必要条件
- 检查网址 [AND] 的末尾是否存在/amp/
- 检查/mobile/folder/file.html 文件是否存在
重写规则
重写为 htpps://www.examplesite.com/mobile/folder/file.html
希望以下内容会有所帮助:
RewriteCond %{REQUEST_URI} "^(.+)/amp/$"
RewriteCond "%{DOCUMENT_ROOT}/mobile/$1.html" -f
RewriteRule "^(.+)/amp/$" "%{DOCUMENT_ROOT}/mobile/$1.html" [L]