【问题标题】:Why do I need to start my wordpress permalink with "/index.php"?为什么我需要用“/index.php”开始我的wordpress永久链接?
【发布时间】:2012-07-10 12:23:59
【问题描述】:

我在http://tallytree.com 上安装了一个相对较新的wordpress。我今天尝试更改永久链接以使其更好。但是,当我使用

/%postname%/

作为永久链接并应用。 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 404 错误。我继续将永久链接更改为这个自定义结构:

/index.php/%postname%/

现在可以了。但是我的网址中有一个 index.php 例如: http://tallytree.com/index.php/comparing-a-few-force-directed-layout-implimentations/

如何设置永久链接,以便 index.php 不必在 URL 中?

【问题讨论】:

    标签: wordpress apache mod-rewrite permalinks


    【解决方案1】:

    将 Wordpress 的永久链接页面中的自定义结构设置为:/%category%/%postname%/

    Wordpress 应该将其写入 .htaccess 文件:

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

    index.php 不会出现在 url 中。如果可行,您可以将自定义结构更改为 /%postname%/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-27
      • 1970-01-01
      • 2011-05-22
      • 2017-09-17
      • 2019-02-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多