【问题标题】:Wordpress Permalink Issue with index.phpindex.php 的 Wordpress 永久链接问题
【发布时间】:2016-06-10 10:21:44
【问题描述】:

为什么即使我激活了 .htaccess,这个示例域 www.example.com/about-us 也不起作用

AddHandler php-stable .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

当您还浏览此链接 www.example.com/index.php/about-us 时,它会将您重定向到此 www.example.com/about-us,但当您浏览此 www.example .com/Index.php/about-us 那是 url 工作的时间。请帮忙。它托管在 Godaddy 上

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    您的主机似乎遇到了mod_rewrite 问题。您可以在您的服务器上创建一个 .php 页面,将其命名为 phpinfo.php 并在其中编写以下代码

    <?php
       phpinfo();
    ?>
    

    在浏览器中打开此页面并查找mod_rewrite 设置。需要打开固定链接才能正常工作。

    现在,转到您的WP Admin Panel -&gt; Settings -&gt; Permalink 并选择/post_name/ Wordpress 将自动写入 .htaccess 文件(前提是它可以访问它)。

    如果您的服务器上未启用 mod_rewrite,则只能联系您的托管服务提供商启用它。它由所有托管服务提供商启用,您仍然必须使用 phpinfo 进行交叉检查。

    以下是 WordPress 完全有效的 .htaccess 文件

    # 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
    

    还要确保 apache.conf 被配置为被 .htaccess 文件覆盖。 AllowOverride none; 等 Apache 设置确保 .htaccess 不受支持。

    【讨论】:

      【解决方案2】:

      根据您解释的查询,我想建议您

      转到WP Admin Panel -&gt; Settings -&gt; Permalink

      然后选择/post_name/前面的单选按钮

      那就去WP Admin Panel -&gt; Appearance -&gt; Menus

      现在检查您是否在菜单中使用了所有页面,或者您是否使用了任何自定义链接?

      同时检查您的.htaccess

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-07-27
        • 1970-01-01
        • 2011-04-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多