简体   繁体   English

永久链接,将页面链接到首页

[英]Permalink, links a page to the homepage

So I'm using the 'post-name' pretty permalink structure. 因此,我使用的是“后名称”漂亮的永久链接结构。

I have a page called The Trust, the slug of this page is the-trust. 我有一个名为The Trust的页面,此页面的标签为-trust。

But when i go onto www.mydomain.com/the-trust, it shows the the homepage. 但是当我进入www.mydomain.com/the-trust时,它显示了主页。 The URL stays the same, but it displays the index.php page. URL保持不变,但是显示index.php页面。

It used to show me the archive.php page, but I removed that from my theme files so now it shows me the index page. 它曾经向我展示了archive.php页面,但是我从主题文件中删除了它,所以现在它向我展示了索引页面。

How can I fix this? 我怎样才能解决这个问题?

If i change the slug to the-trusts, it displays the page fine, however I want the slug to stay as the-trust. 如果我将子弹更改为“信任”,它将显示页面罚款,但是我希望该弹头保留为“信任”。

I used to have a php file in my theme folder called thetrust.php (i've removed that now), the template file that is assigned to The Trust page is called trust-articles.php 我以前在主题文件夹中有一个名为thetrust.php的php文件(我现在已将其删除),分配给“信任”页面的模板文件称为trust-articles.php。

Thanks in advance. 提前致谢。

EDIT: The page does work with Ugly permalinks so www.domain.com/?page_id=174 编辑:该页面确实适用于丑陋的永久链接,因此www.domain.com/?page_id=174

EDIT .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

EDIT FIX: The problem was that I didnt have an archive page for The Trust posts, so it was leading to default archive page, and when I deleted that it redirected to homepage. 编辑修正:问题是我没有The Trust帖子的存档页面,因此它导致了默认存档页面,而当我删除该页面时,它重定向到了主页。 So to fix it I just created a custom-archive page. 因此,要解决此问题,我刚刚创建了一个自定义存档页面。 Now it works. 现在可以了。

Make Sure.... 确保....

  1. You never delete any core file from wordpress theme. 您永远不会从wordpress主题中删除任何核心文件。
  2. page slug does not override any other category or post or post type slug. page slug不会覆盖任何其他类别或帖子或帖子类型的slug。
  3. Check Setting > Reading if " The Trust " page is set to home page there. 如果“ 信任 ”页面在那里设置为主页,请检查设置>读取
  4. If "The Trust" is a page then add its page named as " page-the-trust.php ". 如果“ The Trust”是一个页面,则添加其名为“ page-the-trust.php ”的页面 You dont have to add any other page and make it a template. 您不必添加任何其他页面并使其成为模板。

These may fix your problem. 这些可能会解决您的问题。 If not i'm sure thing is pretty messed up. 如果没有,我确定事情已经搞砸了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM