简体   繁体   中英

Static Homepage on Wordpress

I have a static html page on domain http://www.example.com , then i add subdomain on it and install wordpress. so it should look like this for the wordpress domain http://wpdomain.example.com .

but what i want is http://www.example.com serves as homepage with all the static html page that i created before intact, and the wordpress serves as blog.

and the post i created at wordpress would have permalink like http://www.example.com/category/post-title and only the blog page that will have an url : http://wpdomain.example.com

how can I achieve that? because when I'm trying to change in general setting for the homepage url to http://www.example.com , now i can't access my wp-admin page at all error 500, but i still can open up the blog page now at http://www.example.com/wpdomain but when i using url http://wpdomain.example.com it will redirect me back to http://www.example.com

you can use a .htaccess file on your server to redirect the users when they try to access a page who does'nt exist like this below

errordocument 404 /404.php

this is the 404.php file:

<?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;

?>

when a user will try to access at example.com/category/post-title

he will be redirect on the 404.php page.

404.php will keep the url that the user requested and will show the content of

example.com/wpdomain/category/post-title

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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