我希望将根目录从www.example.com/index.html (基本目录)更改为子目录www.example.com/dist/index.html,并使用.htaccess规则充当www.example.com。
发布于 2021-06-20 13:59:15
要检查的示例.htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
# Your new base directory for files - example index.html
RewriteBase /dist/
# Place for your own rules - example with non-www to www, index.html to domain, http to https
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ![0-9]$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [L,R=301]
RewriteCond %{REQUEST_URI} ^\/index.(html|htm)$
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [L,R=301]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]
</IfModule>https://stackoverflow.com/questions/68049280
复制相似问题