简体   繁体   English

WordPress的重定向到首页和搜索引擎优化

[英]wordpress redirect to homepage and seo

I've created a website (html, css, etc) with 5-6 pages in it, lets say on example.com 我创建了一个网站(html,css等),其中包含5-6页,请在example.com上

Now I have to add many additional pages, and I'm not sure if is better to use WordPress or add all of these pages as pure HTML . 现在,我必须添加许多其他页面,而且我不确定使用WordPress还是将所有这些页面添加为纯HTML更好。

If I will use WordPress, I will install it on a subdirectory like example.com/page . 如果要使用WordPress,则将其安装在example.com/page之类的子目录中。

Wordpress with "permalink" can be useful, but in this case I should set a redirect from the wordpress homepage to my html homepage. 带有“永久链接”的Wordpress可能有用,但是在这种情况下,我应该设置从wordpress主页到html主页的重定向。 For example: 例如:

When someone go on **example.com/page** (wordpress home) 
will be redirected to **example.com** (html homepage)

Instead, if someone go on **example.com/page/my-page**
should see the wordpress page normally.

Its that possibile? 它那可能吗? Which is the best solution for SEO (html static pages, or wordpress with redirect to homepage, separate sitemap, etc)? 哪种是SEO的最佳解决方案(html静态页面或重定向到首页,单独的站点地图等的wordpress)?

You can do it using is_home() function or is_front_page() depending how you set the settings. 您可以使用is_home()函数或is_front_page()完成设置。

<?php if(is_front_page()){
    /** your code for redirecting to html home page. **/
}
?>

This will do what you want. 这将做您想要的。

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

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