【问题标题】:Redirect any non-existing page on domain, to Main Page WordPress将域上任何不存在的页面重定向到主页 WordPress
【发布时间】:2018-10-29 09:11:14
【问题描述】:

我想将用户输入错误的任何页面重定向到主页。

示例:
我有页面

mydomain.com/home

mydomain.com/contact

我想重定向到主页的任何其他页面。

我听说过 404.php 和 .htaccess 文件,但我不知道如何进行简单的重定向。

【问题讨论】:

  • 您必须阅读一些关于 .htaccess 和尝试编码的教程。在 google 上你可以找到很多关于这方面的资料。
  • 已经在google上做了研究,尝试了很多选项和例子,都没有奏效,这就是我在论坛上提问的原因。

标签: php wordpress redirect


【解决方案1】:

将其插入您的 .htaccess(如果不存在,则将其放入网络根目录):

ErrorDocument 404  "insert home page (index.php)"

https://httpd.apache.org/docs/2.4/custom-error.html

【讨论】:

  • 在“插入主页”是网址吗?
  • 它是您服务器上的路径,即 /index.php
猜你喜欢
  • 2012-02-02
  • 1970-01-01
  • 2021-08-08
  • 1970-01-01
  • 1970-01-01
  • 2017-07-09
  • 2015-05-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多