我的根文件夹中有两个文件:main.html和index.php。好的,通常index.php会发生,因为它有更高的响应优先级,只是想要改变逻辑,所以首先用户必须访问main.html,然后被重定向到index.php。我在我的.htaccess中尝试了下面的代码,但它不能像我预期的那样工作。实际上,在这样做之后,现在第一个页面被正确地更改为main.html,但它永远不会重定向到index.php!它实际上一次又一次地返回到main.html (就像循环一样!)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
DirectoryIndex main.html /main.htmlps:
1-即使我尝试请求index.php,它也会打开main.html!
发布于 2015-10-23 18:47:51
您可以使用htaccess文件中的以下内容更改目录的默认页面,就像您在问题中所做的那样。当导航到"www.coolsite.com/“时,用户会登陆main.html (而不是index.php)。
//Change default directory page
DirectoryIndex main.html要将用户重定向到另一个页面,您可以使用以下命令:
window.location = "http://www.coolsite.com/index.php";发布于 2015-10-25 05:22:03
看起来wordpress和静态内容索引页面!不会出现的!(主要是因为现有的RewriteRules + WP内部架构)
解决方法是创建一个“页面模板”(您希望显示为索引页的静态内容),并要求WP将其显示为首页。
https://stackoverflow.com/questions/33300083
复制相似问题