【问题标题】:Create custom folder in wordpress installation在 wordpress 安装中创建自定义文件夹
【发布时间】:2017-09-03 18:57:53
【问题描述】:

您好,我有一个 wordpress 站点,我想在根目录中创建一个自定义文件夹,该文件夹独立于 wordpress。我必须使用什么重写规则才能访问该文件夹? 我放了

RewriteRule ^clients? /clients/index.php [L]

当前的 htaccess 文件

    # BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^clients? /clients/index.php [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

当我访问该文件夹时,我收到内部服务器错误 500

【问题讨论】:

    标签: wordpress .htaccess url-rewriting


    【解决方案1】:

    您必须有一个无限的重写循环,请参阅this answer。试试这个:

    ...
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^clients? /clients/index.php [L]
    ...
    

    为了完美,您可能还需要添加QSA 和NCflags。

    【讨论】:

    • 现在我在我的 wordpress 中收到一个错误 404 页面,因为我试图访问我的 wordpress 网站中的一个页面..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-07
    • 2011-07-18
    • 1970-01-01
    相关资源
    最近更新 更多