Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
让WordPress使用不同的索引文件进行测试_Wordpress_.htaccess - Fatal编程技术网

让WordPress使用不同的索引文件进行测试

让WordPress使用不同的索引文件进行测试,wordpress,.htaccess,Wordpress,.htaccess,我正在设计的一个网站是用静态HTML文件构建的。我正在将其转换为WordPress,但我需要旧站点在WordPress安装在同一目录下时仍能正常工作(例如,将index.html作为默认目录,然后将WordPress设置为类似indexNew.php) 所以他们去了http://domain.com/indexNew.php查看新网站的更新,直到更新完成 我如何在.htaccess文件中配置它?您可以使用带有简单规则的.htaccess将用户重定向到index.html,除非您: Rewrite

我正在设计的一个网站是用静态HTML文件构建的。我正在将其转换为WordPress,但我需要旧站点在WordPress安装在同一目录下时仍能正常工作(例如,将
index.html
作为默认目录,然后将WordPress设置为类似
indexNew.php

所以他们去了
http://domain.com/indexNew.php
查看新网站的更新,直到更新完成


我如何在.htaccess文件中配置它?

您可以使用带有简单规则的.htaccess将用户重定向到index.html,除非您:

RewriteEngine on
RewriteCond %{REQUEST_URI} !/index.html$
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteRule $ /index.html [R=302,L]

用您的公共ip地址替换123.123.123.123

您应该使用.htaccess设置默认文档顺序:

厌倦了在访问yoursite.com时出现yoursite.com/index.html吗?想改为显示yoursite.com/ILikePizzaSteve.html吗?没问题

在您的情况下,根本不需要重命名index.php-这就可以做到:

DirectoryIndex.html index.php

任何请求yoursite.com的人都会看到index.html中的内容。要查看新的Wordpress内容,只需导航到yoursite.com/index.php