使用.htaccess文件将www.mysite.com/index.html重定向到www.mysite.com/

Adv*_*SEO 0 .htaccess

我希望重定向www.mysite.com/index.html

www.mysite.com/

但我不希望用index.html重定向所有地址

www.mysite.com/folder/index.html

www.mysite.com/folder/

因此,只需将第一个index.html页面重定向到站点的根目录.

Ulr*_*lha 10

将以下内容添加到www.mysite.com根文件夹中的.htaccess文件中

RewriteEngine On
RewriteBase /

# redirect html pages to the root domain
RewriteRule ^index\.html$ / [NC,R,L]
Run Code Online (Sandbox Code Playgroud)