简体   繁体   English

默认为index.html,但允许用户键入index.php并获取php页面

[英]default to index.html but allow user to type to index.php and get the php page

I'm busy building a Wordpress website for a client. 我正忙于为客户建立Wordpress网站。 I've developed the site off-line and would now like to upload it to the live server to show the client what I've done so far. 我已经离线开发了该网站,现在想将其上传到实时服务器,以向客户展示我到目前为止所做的事情。 I want to keep the "Under Construction" html page I've create as the default when browsing to the site but if you type in www.sitename.com/index.php I want the actual site to be displayed. 我想保留我在浏览该网站时默认创建的“ Under Construction” html页面,但是如果您输入www.sitename.com/index.php,我希望显示实际的网站。

I don't want to use an "under construction" plugin as I don't want the user to have to enter any form of username or password to gain access to the site. 我不想使用“正在建设中”的插件,因为我不想用户必须输入任何形式的用户名或密码来访问该网站。

I have tried: DirectoryIndex index.htm but as soon as I browse to index.php it flips me back to the index.htm page. 我尝试过: DirectoryIndex index.htm,但是一旦我浏览到index.php,它就会使我回到index.htm页面。

I've had a look here: Make index.html default, but allow index.php to be visited if typed in but unless I'm missing it, there's no real conclusion. 我在这里查看了一下: 将index.html设置为默认值,但是如果键入则允许访问index.php,但是除非我丢失它,否则没有真正的结论。

My development machine runs Windows 8 with XAMPP. 我的开发机运行带有XAMPP的Windows 8。

在您的.htaccess文件中使用此命令将用户在键入域名时重定向到index.html ,如果他特别键入index.php ,则可以进入该页面

RewriteRule ^$ index.html [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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