apache 404-页面不存在页面不存在.

ejk8hzay  于 12个月前  发布在  Apache
关注(0)|答案(9)|浏览(121)

我有一个queryfetch所有从自定义后类型device后,我想显示每页3后。使用nextprevious链接,我能够浏览下一页,另一个3职位可以看到.它可以完美地与默认的permalink一起工作,

//the default permalink of wordpress
http:mywebsite/?p=123

我需要将其更改为Post name用于SEO目的,如下所示:

http:mywebsite/sample-post/

然后问题突然出现了
我已经搜索和阅读更多的博客/文章,但我找不到任何有用的建议。我被这个问题缠住了,弄得我给予。
通过我使用这个查询的方式:

<?php
     if (have_posts()) : {
     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
     query_posts('showposts=3&post_type=advice'.'&paged='.$paged);} ?>

      <ul class="adviceLandingPage">

      <?php while(have_posts()) : the_post(); ?>

       <li>
         <span><?php the_title(); ?></span>
         <span><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,20); ?></span>

       </li>

       <?php endwhile; ?>
          <li class="navigation">
             <?php posts_nav_link(); ?>
          </li>
       </u>
     <?php endif; ?>

谢谢你的任何建议。

编辑:

  • 当我导航到下一页时,我假设看到接下来的3篇文章,这是错误Page not found。*

这是.htaccess后改变permalink %postname%

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

# END WordPress
krugob8w

krugob8w1#

要解决此问题,请执行以下步骤:
1.在Web服务器上找到httpd.conf文件
1.查找代码LoadModule rewrite_module modules / mod_rewrite.so
1.删除前面的#
1.找到代码AllowOverride none并转换为AllowOverride all
就像美味一样简单:)

r6l8ljro

r6l8ljro2#

运行以下命令
注意:$不是命令的一部分

$ sudo a2enmod rewrite

$ cd /var/www/html

$ ls -al

$ sudo touch .htaccess

$ sudo nano .htaccess

修改您的.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
$ sudo chmod 644 .htaccess

$ sudo nano /etc/apache2/sites-available/000-default.conf

确保AllowOverride All已设置

<Directory "/var/www/html">
    AllowOverride All
</Directory>
$ sudo /etc/init.d/apache2 restart

请参阅下面的链接了解更多信息。
https://sachinparmarblog.com/fixing-permalinks-on-wordpress-to-use-postname/

igetnqfo

igetnqfo3#

还要检查httpd.conf文件,并确保.htaccess文件所在目录的AllowOverrideAll

kyks70gy

kyks70gy4#

不确定你是否已经修复了这个问题,但通常你需要做的就是刷新数据库,登录到你的网站,进入永久链接,然后进行更改并保存,如果这没有帮助,
标签:http://codex.wordpress.org/Using_Permalinks

x6yk4ghg

x6yk4ghg5#

我找到了解决办法。
进入WordPress管理面板,转到:
“设置”>“永久链接”>“常用设置”,并将单选按钮设置为“自定义结构”
,然后粘贴到文本框中:
/index.php/%year%/%monthnum%/%day%/%postname%/
,然后单击“保存”按钮。

kyxcudwk

kyxcudwk6#

当我没有给予对.htaccess文件的写访问权限时,就会发生这种情况。更改.htaccess文件的权限解决了我的问题

ycggw6v2

ycggw6v27#

我在Settings-> Permalinks检查Post name和复制.htacces的内容中解决了这个问题,当您保存时会显示。访问虚拟主机并修改.htaccess,然后粘贴内容并保存

k7fdbhmy

k7fdbhmy8#

我在使用LetsEncrypt证书更新到https/SSL后遇到了这种情况。
下面的URL中的说明是有效的,但是我没有更新000-default.conf,而是用“允许所有”更新ssl conf文件。

/etc/apache2/sites-available/domainname-le-ssl.conf

https://sachinparmarblog.com/fixing-permalinks-on-wordpress-to-use-postname/

ui7jx7zq

ui7jx7zq9#

如果你使用的是nginx,并希望改变WordPress的permlinks从平原到文章名称只需添加以下行到nginx文件

location / {
  try_files $uri $uri/ /index.php?q=$uri&$args;
}

如果你的WordPress是安装在特定的文件夹中的例子/博客然后添加此

location / {
  try_files $uri $uri/ /blog/index.php?q=$uri&$args;
}

相关问题