我想将根文件夹目录从 www.example.com/index.html(基本目录)更改为子目录 www.example.com/dist/index.html 并充当 { {3}} 使用 .htaccess 规则
答案 0 :(得分:1)
要检查的示例 .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>