简体   繁体   中英

Change default page from index.php to index.html

Simple as the question. I want to change my website's default page from index.php to index.html . I don't know if my server (000webhost.com, while website is under development) uses Apache, but I've changed the .htaccess file, and added DirectoryIndex index.html index.php . Still not working, though.

When the website loads, it loads randomwebsitename12345.com. If I add /index.html to the string, then the page loads fine, as it should. If I remove the .php file from my server, then the website loads index.html.

Any ideas?

为什么不从.htaccess文件中删除index.php

You can use the following rewrite rule to set index.html as your homepage :

Add this before other rules in your htaccess :

RewriteEngine on


RewriteRule ^$ /index.html [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM