【问题标题】:How to get rid of "Index of /" when I visit my test site? [WordPress]当我访问我的测试站点时如何摆脱“/索引”? [WordPress]
【发布时间】:2016-11-07 14:40:19
【问题描述】:

当我访问我的网站时,我看到如下内容:

/的索引

  • wordpress/

这是文件目录的样子:


.htaccess 文件:

# Do not remove this line or mod_rewrite rules and search engine friendly URLs will stop working
RewriteBase /

# 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]
</IfModule>

# END WordPress
    enter code here

当我访问 example.com 时,我需要做什么才能看到我的 wordpress 网站没有 / 索引和页面列表?

【问题讨论】:

标签: php wordpress ftp hosting


【解决方案1】:

问题是您的public_html 中没有任何index.php 文件。当您获得目录列表时,这是因为该目录中没有与DirectoryIndex 选项匹配的文件。一个典型的 WordPress 网站将包含一个 index.php,因此一旦您将 WordPress 文件放在那里,它就会消失。您可以在 .htaccess 文件中使用 Options -Indexes 来隐藏该页面,但这会给您一个 403 错误,并且仍然不会显示您的内容,因此将内容移动到正确的位置是您真正想要做的。

看来您可能已将文件放入您命名为“wordpress”的目录中。如果是这种情况,请尝试访问http://example.com/wordpress/。如果这不是您想要的,那么只需将“wordpress”的内容移动到 public_html/ 目录中。

【讨论】:

    猜你喜欢
    • 2010-09-24
    • 1970-01-01
    • 2023-02-24
    • 1970-01-01
    • 2015-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-11
    相关资源
    最近更新 更多