Htaccess 仅适用于 http
Htaccess only works for http
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.tdl$
RewriteRule !^MySubFolder /MySubFolder%{REQUEST_URI} [L]
为什么此重写条件仅适用于 http 而不适用于 https?
使用 mod_rewrite 至少需要在文档根目录上设置 "AllowOverride FileInfo" 才能起作用。
检查您的 SSL 配置(默认为 /etc/httpd/conf.d/ssl.conf),确保它类似于:
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride FileInfo
</Directory>
AllowOverride 的默认设置是 'None',因此添加 FileInfo 功能的任何其他设置(例如 'All')都可以。
http://httpd.apache.org/docs/2.4/mod/core.html#allowoverride
有关此答案的更多信息可在此处找到:Why do .htaccess redirects work in http but not with https?
从那里我得到了你问题的可能答案。
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.tdl$
RewriteRule !^MySubFolder /MySubFolder%{REQUEST_URI} [L]
为什么此重写条件仅适用于 http 而不适用于 https?
使用 mod_rewrite 至少需要在文档根目录上设置 "AllowOverride FileInfo" 才能起作用。
检查您的 SSL 配置(默认为 /etc/httpd/conf.d/ssl.conf),确保它类似于:
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride FileInfo
</Directory>
AllowOverride 的默认设置是 'None',因此添加 FileInfo 功能的任何其他设置(例如 'All')都可以。
http://httpd.apache.org/docs/2.4/mod/core.html#allowoverride
有关此答案的更多信息可在此处找到:Why do .htaccess redirects work in http but not with https?
从那里我得到了你问题的可能答案。