这就是我想要的:
*。example.com/abc-> https://example.com/index.php?vars=abc
* m.example.com / abc-> https://example.com/mobile/phtml/index.php?vars=abc
* = https,http,https://www,http://www。,www。
我想这样做,将m.example.com保留在地址栏中,但始终强制使用https。它在* domain.com / category / page / xx上可以正常工作,但在* .m.domain.com / xxxx上不能工作,在这种情况下,即使没有在.com之后传递xxxx参数,我也无法加载index.php。
我的.htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www\.)?example\.com\.br$ [NC]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www\.example\.com\.br%{REQUEST_URI} [NE,R=301,L]
RewriteCond %{HTTP_HOST} ^(?:www\.)?\.m\.example\.com\.br$ [NC]
RewriteRule ^https://\.m\.example\.com\.br https://m\.example\.com\.br/mobile/phtml%{REQUEST_URI} [NC,NE,L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*) index.php?param=$1
Header set Access-Control-Allow-Origin https://www.example.com.br
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule .*\.()$ - [F,NC]