[英]server or domain defaulting back to index.html when index.php is entered
Like others I want to be able to run both index.html and index.php on a site. 像其他人一样,我希望能够在站点上同时运行index.html和index.php。 I want the default site.com to go to site.com/index.html and when typed into the address bar "site.com/index.php" I want this to go to "site.com/index.php" . 我希望默认的site.com转到site.com/index.html,并在地址栏中输入“ site.com/index.php”时,我希望它转到“ site.com/index.php”。 I have the same setup on another Wordpress site that works fine but I can't replicate it on a new one. 我在另一个可以正常运行的Wordpress网站上进行了相同的设置,但是无法在新的网站上复制它。
It will default to "site.com/index.html" stripping out the "index.html" in the address bar, but if I type site.com/index.php in the address bar it reverts to site.com . 它将默认为“ site.com/index.html”,在地址栏中删除“ index.html”,但是如果我在地址栏中键入site.com/index.php,它将还原为site.com。 It strips off the '/index.php' at the same time. 它同时剥离“ /index.php”。 Here is my htaccess file. 这是我的htaccess文件。 Anything obvious? 有什么明显的吗? thanks~ 谢谢〜
DirectoryIndex index.html index.php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
The way WordPress works is that it tries to prevent duplicate URLs, thus, when you go to example.com/index.php
it will (301) redirect you to example.com/
. WordPress的工作方式是尝试阻止重复的URL,因此,当您转到example.com/index.php
,它将(301)重定向到example.com/
。
I gues you could still have index.php
and index.html
by using the right order in your .htaccess (taking into consideration te redirect I mentioned): 我猜测您仍然可以通过在.htaccess中使用正确的顺序来保留index.php
和index.html
(考虑到我提到的重定向):
DirectoryIndex index.php index.html
Then you will have: 然后您将拥有:
index.php ===> /
index.html ==> /index.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.