wordPress查看站点时,显示文件目录

1.在wordpress的代码目录中增加.htaccess文件。

2.在.htaccess文件中加入如下内容:

DirectoryIndex index.php index.html
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

3.在apache的配置文件httpd.conf中:

<Directory "C:/Program Files/Apache SoftwareFoundation/Apache2.2/cgi-bin">
   AllowOverride None
    OptionsNone
    Orderallow,deny
    Allow fromall
</Directory>

AllowOverride None 修改为:AllowOverride All

4.重启apache

原文地址:https://www.cnblogs.com/royhoo/p/5558008.html