【问题标题】:change pageid or create new page for an old pageid in WordPress在 WordPress 中更改 pageid 或为旧 pageid 创建新页面
【发布时间】:2013-10-05 20:22:52
【问题描述】:

背景:简而言之,我犯了一个错误,我有一个指向 http://www.mysite.com/?page_id=7 的外部链接,但页面不存在,显示为 404 错误。

问题:获取可用于显示此 URL 的页面的最快方法是什么?

注意事项:

  • 我可以访问数据库并通过“从 wp_gkpfxa_posts 中选择 ID、post_title、post_name、post_status;”查看数据如果我可以确认需要什么,可以进行更新。

  • 来自数据库

    mysql> 从 wp_gkpfxa_posts 中选择 ID、post_title、post_name、post_parent、post_status;

+----+----------------------------------------------+----------------------------------------------+-------------+-------------+
| ID | post_title                                   | post_name                                    | post_parent | post_status |
+----+----------------------------------------------+----------------------------------------------+-------------+-------------+
|  2 | Sample Page                                  | sample-page                                  |           0 | trash       |
|  7 | Sample Page                                  | 2-revision-v1                                |           2 | inherit  

|

  • 此示例页面未显示,因此我假设我最初将其删除

【问题讨论】:

    标签: wordpress


    【解决方案1】:

    恕我直言,最快的方法是自定义 .htaccess mod_rewrite 规则,该规则指向您想要的任何内容。

    RewriteEngine On
    RewriteCond %{QUERY_STRING} page_id=7
    RewriteRule ^(.*)$ /?page_id=43 [NC,L]
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-06
    • 1970-01-01
    相关资源
    最近更新 更多