【问题标题】:403 forbidden access to non-Wordpress subfolder403 禁止访问非 Wordpress 子文件夹
【发布时间】:2016-08-28 04:44:11
【问题描述】:

我在 Centos 服务器上有一个带有 wp 超级缓存插件的 wordpress 网站,并使用 chmod 777 在根目录中创建了一个子文件夹。 但是当我尝试访问此目录中的文件时,出现错误 403 禁止返回。

htaccess 文件如下所示:

# BEGIN WPSuperCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
...
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]
</IfModule>

# END WPSuperCache

<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>

我尝试添加这个:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/myfolder/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>

但它不起作用。 感谢您的帮助。

【问题讨论】:

    标签: wordpress .htaccess


    【解决方案1】:

    请检查错误日志 - 它应该有足够的关于问题的信息,无论如何这里是我认为应该有帮助的:

    <Directory /path/to/wordpress/root>
    Require all granted #for apache 2.4 or Allow from all for 2.2
    AllowOverride All
    Options +FollowSymLinks
    </Directory>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-02
    • 2014-08-03
    • 2019-03-26
    • 2016-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多