Hi — this tip is for anyone using both wordpress and non-wordpress pages on the same site.
If you’d like to use a wordpress plugin on non-wp pages, or have anything in functions.php tell the non-wp pages what to do — e.g. display a different result from amazon depending on which folder they’re in (see https://www.sitepoint.com/community/t/if-youre-in-this-folder-then-display-this/213124/27) — then on all the non-wordpress pages:
(1) add this at the top before doctype:
where “../” is the path to root folder (public_html) where wp-blog-header.php is.
(2) add this in last line before you close
(3) add this before you close
Some sites and even codex (http://codex.wordpress.org/Integrating_WordPress_with_Your_Website5) will tell you to just add this at the top (in addition to wp_head & wp_footer):
BUT if you do this (leave out the status_header and nocache lines) then WP will return a 404 error on the non-WP pages to bots like googlebot and xml-sitemaps. Essentially all your non-WP pages become invisible to googlebot. Only user browsers will still see them.
WP thinks that the non-WP page is a WP internal URL (because of wp-blog-header) and after it cannot find it internally, returns status code 404 although the page loads fine. So a human being sees it, but a bot sees the 404.
I learned the hard way!
Source: https://managewp.org/articles/14401/integrating-wordpress-into-a-non-wordpress-site
source https://williechiu40.wordpress.com/2017/02/15/integrating-wordpress-into-a-non-wordpress-site/
No comments:
Post a Comment