繁体   English   中英

Wordpress上的静态主页

[英]Static Homepage on Wordpress

我在域http://www.example.com上有一个静态html页面,然后在其上添加了子域并安装了wordpress。 因此,对于wordpress域http://wpdomain.example.com ,它应该看起来像这样。

但是我想要的是http://www.example.com充当主页,并完整保留了我在创建之前创建的所有静态html页面,而wordpress充当了博客。

而我在wordpress上创建的帖子将具有http://www.example.com/category/post-title永久链接,并且只有具有url的博客页面: http://wpdomain.example.com : http://wpdomain.example.com

我该如何实现? 因为当我尝试将主页url的常规设置更改为http://www.example.com ,现在我完全无法访问我的wp-admin页面500,但是我仍然可以打开博客页面现在位于http://www.example.com/wpdomain但是当我使用url http://wpdomain.example.com ,它将重定向我回到http://www.example.com

您可以在服务器上使用.htaccess文件来重定向用户,当他们尝试访问不存在以下页面的用户时

errordocument 404 /404.php

这是404.php文件:

<?php 

// get the url of the page who give an 404 error 'page doesn't exist'
$url = $_SERVER['REQUEST_URI'];

$url=substr($url,1,strlen($url));   

$path = '/wpdomain/'.$url;

$content = file_get_contents($path)

echo $content;

?>

用户何时尝试访问example.com/category/post-title

他将在404.php页面上重定向。

404.php将保留用户请求的网址,并显示其中的内容

example.com/wpdomain/category/post-title

暂无
暂无

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

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