咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
根据自己代码需求复制如下代码到.htaccess文件
<Files ~ "^.(htaccess|htpasswd)$">
deny from all
</Files>
DirectoryIndex index.html index.php
order deny,allow
上面代码的意思是:网站默认打开根目录下文件的顺序。首先是“index.html",若?有该文件,则打开“index.php"。如果是用asp语言开发的网站,代码可以如下设置:
<Files ~ "^.(htaccess|htpasswd)$">
deny from all
</Files>
DirectoryIndex index.html index.asp
order deny,allow
? 当目录中没有“index.html”文件时,默认打开“index.asp”文件。
若果是新手站长,不清楚自己网站的开发环境,又想设置默认打开静态文件时,可以考虑直接使用如下代码。
<Files ~ "^.(htaccess|htpasswd)$">
deny from all
</Files>
DirectoryIndex index.html index.php index.asp index.shtml index.htm index.jsp index.aspx
deny,allow
代码的意思大致和上面差不多,设置的是默认打开网站目录下文件的顺序依次是index.html、index.php、index.asp、index.shtml、index.htm、index.jsp、index.aspx。
根据自己需要选择,复制好相应的代码,粘贴到记事本,保存为".htaccess"文件。然后通过FTP上传到网站的更目录即可