【问题标题】:Permalinks not working even after fixing .htaccess file即使在修复 .htaccess 文件后,永久链接也不起作用
【发布时间】:2016-11-15 03:48:19
【问题描述】:

我刚刚移动了我的 wordpress 网站。移动除主页以外的所有页面后显示为 404 未找到。以下是我尝试过的步骤。

我已更改为默认永久链接,并且可以正常使用这些链接。

将以下代码添加到 .htaccess

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

知道它可能是什么吗?链接是http://dev.pwlawyers.ca/

【问题讨论】:

    标签: php wordpress .htaccess


    【解决方案1】:

    您的服务器正在运行 Nginx 网络服务器,而 .htaccess 用于 Apache 网络服务器。

    【讨论】:

    • 你说得对,我很笨。任何机会你都可以给我一些基本知识,让我知道如何做才能做到这一点。我通常不处理这个。通常只是用复印机移动所有东西,从来没有问题。
    【解决方案2】:

    所以我想我已经修复了它:

    如果您的 wordpress 安装在文件夹的根目录中,则将其添加到配置文件位置块:

    location / {
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$args;
    }
    

    如果它在文件夹中,例如 wordpress 文件夹,则添加:

    location /wordpress/ {
        try_files $uri $uri/ /wordpress/index.php?$args;
    }
    

    重新加载nginx应该没问题。

    【讨论】:

      【解决方案3】:

      添加过滤器

      您可以通过插件(或主题功能等)添加以下过滤器:

      // Stop WordPress from modifying .htaccess permalink rules add_filter('flush_rewrite_rules_hard','__return_false');

      谢谢

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-12-21
        • 2011-03-22
        • 2011-05-18
        • 2015-07-03
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多